Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 connection problems....please help!!!

Author  Topic 

RDV
Starting Member

2 Posts

Posted - 2009-07-20 : 09:03:25
Hello all,

please forgive me if I am asking a dumb question. I'm a newbie to both asp.net and sql, and am not an IT Pro either....just an enthusiastic amateur. Apologies too for using up so much bandwith.

I created a membership website in microsoft visual studio 2008 express (membership database created automatically by .NET in sql server express 2008). Both worked perfectly on my computer, and I thought I was ready to go live.

However, ever since I copied the files to my ISP hosting server, everything that needs to access the membership database throws up an 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."

I believe that this might be caused by something wrong in my web.config connection strings (which were automatically generated by visual studio express). The connection strings I have at the moment are:

<connectionStrings>
<add name="crewswapConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\klcdutymatrix.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="membershipdatabase" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>


also, when I looked at the asp.net config settings in IIS, I found a 3rd connection string called "localsqlserver" (????)

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True

Can anybody please advise if there is something wildly wrong in any of these strings and how I can go about fixing it?

( I have set up a user login and required database tables on my ISP host server's SQL Server 2008, so I do not even need to connect to the sqlexpress databases anymore. I can use my host ISP SQL Server instead, but that seems quite complicated)

The full error stack is:

[SqlException (0x80131904): 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.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4861315
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +87
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +221
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +815
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +78
System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +119
System.Web.UI.WebControls.Login.AttemptLogin() +115
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2009-07-20 : 16:44:36
is your db in your app_data folder ?

and did you give it read permissions ?
Go to Top of Page

RDV
Starting Member

2 Posts

Posted - 2009-07-22 : 05:39:05
Thank you. I solved the problem by migrating all my databases to the host server, and changing all the connection sytrings to point to the host server.

Everything now works as it should.........EXCEPT;

I now need to be connected to the internet to do anything with my databases, or even to view my webpages on my browser (cos everything starts from a login page that uses "membership")

Is there a way round this? Can I have one webconfig file for when I am working online, and one for when I am not? And how do I go about it?

Thanks for your help
Go to Top of Page

zeeshanakhter2009
Starting Member

2 Posts

Posted - 2011-07-28 : 13:10:55
quote:
Originally posted by RDV

Thank you. I solved the problem by migrating all my databases to the host server, and changing all the connection sytrings to point to the host server.

Everything now works as it should.........EXCEPT;

I now need to be connected to the internet to do anything with my databases, or even to view my webpages on my browser (cos everything starts from a login page that uses "membership")

Is there a way round this? Can I have one webconfig file for when I am working online, and one for when I am not? And how do I go about it?

Thanks for your help











Zeeshan Akhter
+92-332-7544933

http://www.google.com.pk/webhp?rls=ig#sclient=psy&hl=en&rls=ig&biw=1024&bih=581&site=webhp&source=hp&q=zeeshan+akhter+java&aq=0&aqi=g1g-sv1&aql=f&oq=&pbx=1&fp=a3c1530b0034a8d0

Go to Top of Page

zeeshanakhter2009
Starting Member

2 Posts

Posted - 2011-07-28 : 13:12:37
dear plz tell me how u change connecton string in ur project i have similar error


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.








Zeeshan Akhter
+92-332-7544933

http://www.google.com.pk/webhp?rls=ig#sclient=psy&hl=en&rls=ig&biw=1024&bih=581&site=webhp&source=hp&q=zeeshan+akhter+java&aq=0&aqi=g1g-sv1&aql=f&oq=&pbx=1&fp=a3c1530b0034a8d0

Go to Top of Page
   

- Advertisement -