Most of the time when I get this problem, I take the mdf and ldf files and adds them to my local SQL database (SQL Express works).
Not the best solution but at least a workaround that works for me.
Ensure your application App_data folder: C:\EpiDemos\PML\PML\App_Data\ has permissions so the database can be created. I normally add Everyone > all on a dev machine.
Try rynning as admin in VS? Are you also trying to add the project to for instance TFS at the same time? That procedure can lock files to be read only as well.
This issue may still occur if the user running the application, i.e. Visual studio doesn't have access to the app_data folder as David Knipe suggested. Ensure the user running the application has full access to the app_data folder by modifying the permissions.
Also, if this is a new project adding createDatabaseSchema="true" on the episerver.framework element may help unless you prefer updating the database manually by running the cmdlet 'Initialize-EPiDatabase' in the package manager console.
<episerver.framework createDatabaseSchema="true" updateDatabaseSchema="true"> ... </episerver.framework>
Hi,
I am getting below error when I select Empty template to create EpiServer Web Site by VS.
Also, no DB is created in App_Data. Only GeoLiteCity.dat file is created under this folder.
Please help.
Server Error in '/' Application.Could not open new database 'EPiServerDB_2767df9b'. CREATE DATABASE is aborted.
Cannot attach the file 'C:\EpiDemos\PML\PML\App_Data\EPiServerDB_2767df9b.mdf' as database 'EPiServerDB_2767df9b'.
File activation failure. The physical file name "C:\EpiDemos\PML\PML\App_Data\EPiServerDB_2767df9b_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.
Exception Details: System.Data.SqlClient.SqlException: Could not open new database 'EPiServerDB_2767df9b'. CREATE DATABASE is aborted.
Cannot attach the file 'C:\EpiDemos\PML\PML\App_Data\EPiServerDB_2767df9b.mdf' as database 'EPiServerDB_2767df9b'.
File activation failure. The physical file name "C:\EpiDemos\PML\PML\App_Data\EPiServerDB_2767df9b_log.ldf" may be incorrect.
The log cannot be rebuilt when the primary file is read-only.
Source Error:
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\427d5686\520a12d0\App_global.asax.0.cs Line: 0
Stack Trace: