Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed

我怕爱的太早我们不能终老 提交于 2019-11-26 18:27:49

问题


I've attempted to add a "service based data base" (.mdf) to a project in an asp .net application. From there I've proceeded attempted to create an entity framework model file (.edmx).

When doing so I get the error:

An error occurred while connecting to the database. The database might be unavailable. An exception of type 'System.Data.SqlClient.SqlException' occurred. The error message is: 'Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.'.

I've got SQL Server 2008 R2 Express edition installed on my machine.

Any ideas would be most appreciated.


回答1:


I have got the same error, it's fixed after the following change.

Deleting the folder C:\Users\User\AppData\Local\Microsoft\Microsoft SQL Server Data worked for me in Windows 7. Have to restart VS after deleting the folder.




回答2:


I had this exact same problem with a C# Console App that was utilizing an .mdf file.

The issue disappeared once I granted NETWORK SERVICE full access to my root-level Visual Studio project directory (and sub directories).

Solution Details: Problems with SQL Server Express user instancing and ASP.net Web Application Projects




回答3:


See this answer, which might work for you.

Based on your connection string, you might need to add "User Instance" attribute to it.



来源:https://stackoverflow.com/questions/7375857/failed-to-generate-a-user-instance-of-sql-server-due-to-a-failure-in-starting-th

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