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

允我心安 提交于 2020-01-02 07:33:12

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/10010324/login-failed-for-user-xxx-failed-to-open-the-explicitly-specified-database-sol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!