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.


Lately, I’ve been getting this quite a lot on my development VM. I have a SQL Server 2008 Express Edition database in the App_Code folder of my Web site, and sometimes when I get the error, closing down the browser and running the Web site again from within Visual Studio solves it. However, more often than not, that doesn’t do it. Stopping the ASP.NET Development Server doesn’t fix it either nor does closing down and reopening Visual Studio.

What does the trick, is to clear the items in this folder, %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. If the files are locked, you’ll need to reboot your machine, and delete the files before you run your Web site again.

You can also open up the Task Manager and delete all sqlservr.exe processes, but I think a reboot is better…

— UPDATE —

It turns out that you don’t have to delete the files, but simply kill the sqlservr.exe process that runs under your account (the logged in identity). Much easier…

Advertisements