Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login failed for user "xxx" Failed to open the explicitly specified database solution

Im using entity framework code first. When starting the application the application tries to create the database on SQLServer2008R2.

The error message that I'm receiving is:

"Login failed for user "NT instans\Networkservice" Failed to open the explicitly specified database"

After looking more carefully at the problem in the SQLServer log i can see that the error code is: 18456 severity 14 with state 38. Read about it on: http://sql-articles.com/articles/troubleshooting/troubleshooting-login-failed-error-18456/

Do anybody have a idea how to solve this problem?

like image 983
user473104 Avatar asked Oct 21 '25 03:10

user473104


2 Answers

I just thought I'd put a solution here that I found after wasting between two programmers too much time: delete the .suo file. I realise the initial question was asked 18 months ago but it might save someone coming across this question in the future.

We tried installing different versions of Visual Studio, deleting localdb instances, logging in as SA, everything.

like image 190
Sam Avatar answered Oct 26 '25 18:10

Sam


I faced very similar issue in a web API project in VS 2015 today. I did a clean operation on my C# web API project from solution explorer and it just worked. This was quite crazy. The same sa credential (configured in web.config file of my project) was working throughout the day and it suddenly stops working out of no where.

Many other posts including this one suggest deleting *.suo files but I believe Visual Studio isn't creating *.suo files any more. I didn't see them at least in my VS 2015 environment.

like image 26
RBT Avatar answered Oct 26 '25 16:10

RBT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!