Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have following error while opening my application sql database
"Failed to generate a user instance of SQL SERVER due to a failure in starting process for the user instance. The connection will be closed."

Check your connection string: can you reach the server it lists?
If this is really ASP.NET, have you tried to reach your development server on the production site? Or vice versa?

Do you have SQL Server installed on a machine the application can reach?
Share this answer
you ever tried to create a user instance database from Visual Studio on SQL Server 2005 Express (or above) and got this terrible more confusing message?:

"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."

If you did and tried to find how to resolve this you probably Googled (or Binged) for hours without being able to find the solution that really works.

Well lets put an end to that. Two simple things need to be done:

Step 1. Enabling User Instances on your SQL Server installation
First we are gonna make sure we have enabled User Instances for SQL Server installation.

Go to Query Window in SQL Server Management Studio and type this:

exec sp_configure 'user instances enabled', 1.

Run this query and then restart the SQL Server.

Step 2. Deleting old files
Now we need to delete any old User Instances.
Go to your C drive and find and completely DELETE this path (and all files inside):

C:\Documents and Settings\YOUR_USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

(Dont forget to replace the YOUR_USERNAME in the path with your current username (if you are not sure just go to C:\Documents and Settings\ path to figure it out).

After deleting this dir you can go to Visual Studio, create ASP.NET WebSite and click on your App_Data folder and choose Add New Item and then choose SQL Server Database and it should work!!!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900