Error: Failed to generate a user instance of SQL Server

前端 未结 11 1632
無奈伤痛
無奈伤痛 2020-12-02 14:54

I\'m trying to connect to an MDF. I\'ve even gone to the lengths of re-installing sql server express entirely (it is now the only flavor of SQL installed on my box, where p

相关标签:
11条回答
  • 2020-12-02 15:04

    I experienced the same error when i moved the code from one machine to another. i am using VS2010 and SQLEXPRESS 2008 comes along with it.

    Trick , deleting all the contents from the following folde "C:\Users\UserName\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS" worked for me.

    0 讨论(0)
  • 2020-12-02 15:08

    I started getting this error this morning in a test deployment environment. I was using SQL Server Express 2008 and the error I was getting was

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

    Unsure about what caused it, I followed the instructions in this post and in other post about deleting the "C:\Users\UserName\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS" directory, but to no avail.

    What did the trick for me was to change the connection string from

    "Data Source=.\SQLExpress;Initial Catalog=DBFilePath;Integrated Security=SSPI;MultipleActiveResultSets=true"
    

    to

    "Data Source=.\SQLExpress;Initial Catalog=DBName;Integrated Security=SSPI;MultipleActiveResultSets=true" 
    
    0 讨论(0)
  • 2020-12-02 15:12

    ok, it works now! guess it was a compound problem ... the steps I took to resolve it are as such:

    1. Changed the following property in the connection string (note the subtle difference): AttachDbFilename=|DataDirectory|CustomerDb.mdf;
    2. Deleted the contents of the following directory: c:\Users\<user name>\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. I thought I had looked for this before, but I had actually looked in the Microsoft Sql Server folder. Again, a subtle difference.

    Once I did these two things, the connection started working :-D

    0 讨论(0)
  • 2020-12-02 15:12

    Just go to web.config file. Change in 'Connection String'="....../.../......?.......; User Instance=True'" to "....../.../......?.......; User Instance=False'"

    Yes this may cause some security issues, but for some school/college practical-project(Which was my case) this can run your project.

    change from User Instance=True to User Instance=False , in web.config

    0 讨论(0)
  • 2020-12-02 15:12

    To fix this, please Open the SQL Server Management Studio Express. In the query editor type this text:

    sp_configure 'user instances enabled', 1;
     RECONFIGURE
    

    Run it. Then restart the SQL Server database.

    0 讨论(0)
  • 2020-12-02 15:16

    In addition to the other solutions here, this one may also be helpful. Ensure the Application Pool is running as network service, and not ApplicationPoolIdentity.

    This solution was found here: http://blogs.msdn.com/b/webdevelopertips/archive/2010/05/06/tip-106-did-you-know-how-to-create-the-aspnetdb-mdf-file.aspx

    0 讨论(0)
提交回复
热议问题