Someone asked me today how to fix this error that he encountered after creating a new Episerver MVC project with the Alloy Template. I remember seeing this before myself and so I’m putting up a post for those out there who encounter the same problem.
Server Error in ‘/’ Application.
Could not open new database ‘EPiServerDB’. CREATE DATABASE is aborted.
Cannot attach the file ‘EPiServerDB.mdf’ as database ‘EPiServerDB’.
File activation failure. The physical file name “EPiServerDB_log.ldf” may be incorrect.
The log cannot be rebuilt when the primary file is read-only.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Solution
- Run your Visual Studio as Admin OR go to your App_Data folder and give your user Full Control on the folder
- AND update your web.config to add the two attributes on your epi framework config
<episerver.Framework
createDatabaseSchema="true"
updateDatabaseSchema="true">
The combo above has fixed his issue.
If it hasn’t, try this thread which may have other solutions that hopefully applies to you.