Answer the question
In order to leave comments, you need to log in
"Permission denied" when trying to create a database file (Code First) in the App_Data directory. How to fix?
An account with administrator rights.
I did not change the rights to the App_Data folder.
The project itself is in "My Documents".
SQL Server Express 2017.
<add name="DrinkContext" connectionString="Data Source=.\SQLExpress;AttachDbFilename=|DataDirectory|\Drinks.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"/>
System.Data.SqlClient.SqlException: 'Directory lookup for file 'C:\Users\sumo\Documents\Visual Studio 2017\Projects\SodaDispencer2\SodaDispenser2\App_Data\Drinks.mdf' failed, causing operating system error 5(Denied access.).
CREATE DATABASE operation failed. Some of the listed filenames were not created. Check related errors.'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question