Failed to generate a user instance of SQL Server
Written . In Technology. Tagged .Net, .Net MVC, Microsoft, and SQL.
I ran into an issue while playing with Microsoft’s .Net MVC framework. I created a new MVC project using the default template. When I tried to register a user I got the following an error:
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance.
By default, MVC is setup to automatically create a database in the project’s
App_Data folder. This database is contained in a file called aspnetdb.mdf
and typically holds your MVC project’s . However, in my case, the
aspnetdb.mdf file was not getting created.
The solution is to delete the SQL Server Data found in your user folder. This doesn’t destroy any databases you currently have. It seems to force SQL Server to reconfigure your user instance. I found the solution mentioned here on the asp.net forum.
On Windows XP, delete the following folder:
C:\Documents and Settings\<USERNAME>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
On Windows Vista, 7, or better; delete the following folder:
C:\Users\<USERNAME>\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
In either case, replace <USERNAME> with your own user name. Then restart your
application and try again.