question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update-Database fails creating a database with mssqllocaldb

See original GitHub issue

Dear Maintainer,

Update-Database fails creating a database with mssqllocaldb when using the default App.config I receive the following error: CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\Users\[Username][Projectname].[Contextclass].mdf’.

It looks like it is missing a '\' between the username and the projectname.

Is this database location assigned by SQL Server LocalDb or is this a problem in ‘System.Data.Entity.Infrastructure.LocalDbConnectionFactory’?

Thank you in advance.

Best regards,

NiekGr

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:24 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
ErikEJcommented, Jul 14, 2018

Installing and applying the latest SQL Server 2017 CU is probably the simplest cure.

7reactions
dtiemstracommented, Jun 19, 2018

Seems related to conflicting version of SQLLocalDB. Visual Studio comes with version 2016. The problem occurs when you have installed version 2017. To resolve the problem follow these steps:

  • Uninstall Microsoft SQL SERVER 2017 LocalDB
  • Open command prompt
  • SqllocalDB i “MSSQLLocalDB” (will probably give you an error)
  • SqllocalDB delete “MSSQLLocalDB”
  • SqllocalDB create “MSSQLLocalDB” This will recreate the instance using the correct (2016) version of SQL Server LocabDB

EntityFrameWork migraton will now succeed (slash is added to the path)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update-Database - Error with (localdb)\MSSQLLocalDB
This error message informs you that it is not possible to connect to MSSQL Server and app will not connect to the database....
Read more >
Update-Database failing to create database - missing a ...
At the Update-Database point, I am receving this error message: CREATE FILE encountered operating system error 5(Access is denied.) ...
Read more >
LocalDB v14 creates wrong path for mdf files
UPDATE. As of CU 6 for SQL Server 2017, this bug has been fixed. It is now possible to execute the following successfully:...
Read more >
MSSQLSERVER_18456 - SQL Server
A connection attempt is rejected due to a failure with a bad password or username in SQL Server. See an explanation of the...
Read more >
Update-Database not creating tables in SQL Server when ...
I'm creating a Student Management MVC application that will manipulate information from a database. I added the DBContext builder.Services.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found