[ADO.NET error]: CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file HelloWorld.mdf failed
Solution 1
Generally the user that you are using to run the SQL Server service will not have access to your personal user folders, that is why you're getting the error. You either need to change the credentials used for the service, or move the database to another folder, which did the trick in your case.
Solution 2
For me helped a lot to set this tag under system.web tag on the web.config file:
<system.web>
<identity impersonate="true" userName="admin_user" password="admin_password" />
...
Hope this can help somebody
Solution 3
I was stuck on this today with compound issue in mvc3 and entity framework code first.
My SqlExpress install is messed up (permissions issues) so I switched to SqlCE.
My ConnectionString.Name attribute didn't match my "ProjectNameContext" class name.
When the connection string isn't found, it uses default conventions. Default conventions means my SqlExpress service with a database name like "ProjectNameContext". The permissions are messed up on that so I got a permissions error on SqlExpress when I thought I was using SqlSE
Solution 4
I was also experiencing the same Problem, finally i find Solution- SOLUTION -- Is simple Move or Cut your database from the App_Data folder to any where (e.g., Desktop) then Move or Cut back DataBase to App_Data folder. That is it..........
Hope it work!
Mark Cidade
I first learned BASIC at age 11 on a Commodore 64. Former SDET, ADO.NET Team @ Microsoft. “I must create a system, or be enslaved by another man’s,”—William Blake
Updated on June 19, 2022Comments
-
Mark Cidade almost 2 years
CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\Documents and Settings\..\App_Data\HelloWorld.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
I've found these links: