Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Failed to generate a user instance of SQL Server. Expand / Collapse
Author
Message
Posted Tuesday, May 14, 2013 2:53 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 5:50 AM
Points: 1,234, Visits: 1,435
My SqlExpress application was running fine, I renamed the ASPNETDB database (it was called [C:\inetpub\wwwroot\website1\App_Data\ASPNETDB.mdf] and the application ran ok. I then tried removing the Integrated Security=SSPI and using a username and password in the connection string. This also worked for a while, but I started getting this error:


Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

[SqlException (0x80131904): Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5296071
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1682
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +69
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +30

... Yada Yada ...


I have reverted to the connection string, but am still getting the error. I've tried User Instance=false - same error. Googling suggested removing the C:\Users\<username>\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS directory - same error. I can still connect to SQLEXPRESS using SSMS - its just the ADO.NET connection that fails.

Also tried rebooting and restarting SQLEXPRESS.

List of connection Strings tried: (none work)


<add name="ConStr_Main" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=false" providerName="System.Data.SqlClient" />

<add name="ConStr_Main" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />

<add name="ConStr_Main" connectionString="data source=.\SQLEXPRESS;Uid=UserName;Pwd=Password;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=false" providerName="System.Data.SqlClient" />

<add name="ConStr_Main" connectionString="data source=.\SQLEXPRESS;Uid=UserName;Pwd=Password;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />


I am out of ideas.
Post #1452436
Posted Tuesday, May 14, 2013 5:22 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 5:50 AM
Points: 1,234, Visits: 1,435

What fixed this was connecting to SqlExpress in Visual Studio, Server Explorer - creating a new data connection.

This re-created the C:\Users\<username>\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS directory - with default copies of msdb, master and tempdb


Post #1452511
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse