Subject: Failed to generate a user instance of SQL Server
Posted By: naeem.net Post Date: 6/3/2008 2:53:29 PM
I spend tow weeks looking for an anwser to this problem but no luck. I have a simple ASP.NET 2.0 application which run correctly on my local machine.
But After uploading all files including web.config file on a Windows 2003 Server with SQLEXPRESS installed. I have this error. Please Help!!!!!!

Error Message

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. 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.

Exception Details: System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.



Ali Naeem
Reply By: planoie Reply Date: 6/3/2008 4:01:23 PM
Assuming that you are running this as a real site in IIS this doesn't surprise me.  The user account created for running sites will be significantly different from yours on your local machine.

You really should run the database on a real running instance of a database server (regular SQL Server 2005).  Or you could run express but set up an attached database instead of using the dynamic attaching that express supports.  Then change your connection string to point to the regular instance and database name instead of at the data file.

-Peter
compiledthoughts.com
Reply By: naeem.net Reply Date: 6/4/2008 12:52:02 PM
Hi peter, thanks for your reply.
O.K i will try to run the database from on real running instance.
The connection string that i used is:

<connectionStrings>
<add name="aafaqConnectionString1" connectionString="Data Source=.\SQLEXPRESS;Server=69.72.149.252;AttachDBFilename='C:\Inetpub\vhosts\babylon-uni.com\httpdocs\App_Data\aafaq.mdf';Integrated Security=SSPI;User Instance=True" providerName="System.Data.SqlClient"/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=aafaq;AttachDBFilename='C:\Inetpub\vhosts\babylon-uni.com\httpdocs\App_Data\aafaq.mdf';Integrated Security=SSPI;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

Is that correct?

Ali Naeem

Go to topic 71880

Return to index page 1