Ca4nul @ facebook Ca4nul @ Twitter
Forum announcement: $$ Top Contributors Contest (March 2010) - Win Instant extra Cash $$
Welcome Guest Search | Active Topics | Members | Log In | Register

asp.net membership provider problems Options
richard
Posted: Wednesday, July 22, 2009 10:54:22 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2008
Posts: 149
Points: 447
Location: California, USA
Hello all,

please forgive me if I am asking a dumb question. I'm a newbie to visual studio express, 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:

Code:
<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:

Code:
[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
Sponsor
Posted: Wednesday, July 22, 2009 10:54:22 AM
adam
Posted: Wednesday, July 22, 2009 10:55:45 AM
Rank: Advanced Member
Groups: Member

Joined: 4/3/2008
Posts: 142
Points: 432
Location: London
When you use ASP.NET Administration tool to create Membership provider for your application, it creates a database( you can see a database in your App_Data folder in Visual studio solution explorer).

Above connection string is the one used to access the database from App_Data folder and it is looking for SQL Express database.

The exception you are getting is due to the reason that your application looking for local SQL Express database on Web server. (through your Web.config <connectionStrings> section).

Resolution:

You need to migrate your database to your production database server (if you have one) or make sure your application database is migrated to ISP database propertly.

Resources:

I would suggest you to watch couple of videos at http://www.asp.net/learn/security-videos/

Watch especially,vidoe on custom database for Membership.

Let me know further queries.

Thanks,
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

ASPNET Theme created by Boskone (Dan Ferguson)
Powered by Ca4nul.Com
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.172 seconds.