SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Failed to generate a user instance of SQL Server.


Failed to generate a user instance of SQL Server.

Author
Message
Tom Brown
Tom  Brown
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3256 Visits: 1491
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.
Tom Brown
Tom  Brown
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3256 Visits: 1491
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search