I got this strange error when adding a database to the App_Data folder of a web application project :
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.
Deleting the C:\Documents and Settings\<username>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data folder has resolved the problem. I had to try twice after that for adding it correctly.