Saturday, 7 May 2011

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

After my fun with trying to get VS, SQL and Phone Tools all working together, I had the following error trying to mount databases:

"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 get that error message, the solution that worked for me was to clear the SQL Express user instance data store, located at:

%userprofile%\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS
(or full path)

C:\Users\\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

Hope this helps someone!

36 comments:

  1. thank you that's work for me

    ReplyDelete
  2. HI I like to share what I found.
    I tried what you and many of them said but I couldn't get it done properly. I worked with the .mdf database file not connect with the SQL Server so all I have done change the
    connection string to this

    @"Data Source=.;AttachDbFilename=" + Server.MapPath("~/DATABASE_NAME") + @";Integrated Security=True;Connect Timeout=30;User Instance=True";

    instead
    .\SQLEXPRESS
    I used this
    .
    then it worked. also it can be done with Server Explorer-> Add New Connection-> Select SQL Database File or something then go to Advance and replace .\SQLEXPRESS with . that's all.

    if someone has any trouble regarding this so this might be the solution for you if non of things worked.

    ReplyDelete
    Replies
    1. Thanks, works like a charm....

      Delete
    2. still i can not create database. what can i do?

      Delete
  3. Thanks, It was really helpful...

    ReplyDelete
  4. Thanks. It worked just fine

    ReplyDelete
  5. Thanks. It worked just fine

    ReplyDelete
  6. Superb, that simple suggestion worked first time, all of the complicated ones from elsewhere didn't.

    Thank yoy.

    ReplyDelete
  7. Thanks !your suggestion worked..

    ReplyDelete
  8. worked. thanks! :)
    but.. what did it do?

    ReplyDelete
  9. thank you very much!
    it worked fine

    ReplyDelete
  10. Appdata doesn't appear

    ReplyDelete
  11. Wont let me modify it

    ReplyDelete
  12. Worked fine for me. Thanks

    ReplyDelete
  13. Worked well thnx

    ReplyDelete
  14. Worked for me!! THX

    ReplyDelete
  15. Gryphes, I did what you have told,but its showing the following error,

    "A network related or instance-specific error occured while establishing the connection to the SQL Server...."

    What shall I do now?

    ReplyDelete
  16. William what shall be the full path for Windows XP?

    ReplyDelete
  17. thank you very much... it worked:)

    ReplyDelete
  18. it works!
    Thanks

    ReplyDelete
  19. Worked for me! Thanks a lot! =)

    ReplyDelete
  20. Nice, thanks it worked.

    ReplyDelete
  21. Can you anybody tell me how to create database in vs 2010 project inbuilt ?

    ReplyDelete
  22. How to create .mdf database in vs 2010 ?

    ReplyDelete
  23. Thanks, It's Work successfully........

    ReplyDelete
  24. worked, thanks!!

    ReplyDelete
  25. its not working for me
    ....i have deleted the contents...bt still it is not working

    ReplyDelete
  26. There is an inclination to trust that loan specialists are fixated using a credit card scores, however this is untrue. We are cautioned about our record of loan repayment to urge us to keep up our reimbursement plans, however banks are more enthusiasm for different elements. Check Cashing San-diego

    ReplyDelete