SQL Membership Provider Problem

G

GaryDean

My ASP.Net application, that uses the SQL Membership Provider, runs fine on
my development box (server2003) as long as I use the standard provider.
But, in anticipation of deployment to other servers I am attempting to
register another provider instance.

I'm not sure this is the right deployment choice but I haven't found any
guidelines on how to best deploy apps using the SQL Membership provider.

I first attached C:\Inetpub\wwwroot\PTPEmployment\App_Data\ASPNETDB.MDF to
my local SQL Server instance and renamed the data base to PTPSecurity
(because that's a shorter name).

I then added the following to my web.config....

a connection string in the connection strings section.....
<add name="AUTHConnectionString" connectionString="Data
Source=DEVSERVER2003;Initial Catalog=PTPSecurity;Integrated Security=True"
providerName="System.Data.SqlClient"/>

and.....
<membership defaultProvider="SqlProvider">
<providers>
<clear />
<add connectionStringName="AUTHConnectionString" applicationName="/"
name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

Now, the applications runs for some things and the asp.net website
configuration utility will run for some things. But both also get the
following error with some things withing the provider database are accessed.
For instance if I try to access roles in either the application or the
utility I get the error pasted below.

#1 can anyone tell my why this is happening and #2 how are we supposed to
deploy apps with the ASPNETDB.MDF database?

The following message may help in diagnosing the problem: Cannot open user
default database. Login failed. Login failed for user
'DEVSERVER2003\Administrator'. at
System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean
isMembership, String methodName, Object[] parameters, Type[] paramTypes) at
ASP.security_roles_manageallroles_aspx.BindGrid() at
ASP.security_roles_manageallroles_aspx.Page_Load() at
System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)

thanks,
Gary
 
S

sloan

http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx


<configuration>



<connectionStrings>

<remove name="LocalSqlServer"/>

<add name="LocalSqlServer" connectionString="Data
Source=localhost;Initial Catalog=appservicesdb;Integrated Security=True"
providerName="System.Data.SqlClient"/>

</connectionStrings>



</configuration>







GaryDean said:
My ASP.Net application, that uses the SQL Membership Provider, runs fine
on my development box (server2003) as long as I use the standard provider.
But, in anticipation of deployment to other servers I am attempting to
register another provider instance.

I'm not sure this is the right deployment choice but I haven't found any
guidelines on how to best deploy apps using the SQL Membership provider.

I first attached C:\Inetpub\wwwroot\PTPEmployment\App_Data\ASPNETDB.MDF to
my local SQL Server instance and renamed the data base to PTPSecurity
(because that's a shorter name).

I then added the following to my web.config....

a connection string in the connection strings section.....
<add name="AUTHConnectionString" connectionString="Data
Source=DEVSERVER2003;Initial Catalog=PTPSecurity;Integrated Security=True"
providerName="System.Data.SqlClient"/>

and.....
<membership defaultProvider="SqlProvider">
<providers>
<clear />
<add connectionStringName="AUTHConnectionString" applicationName="/"
name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

Now, the applications runs for some things and the asp.net website
configuration utility will run for some things. But both also get the
following error with some things withing the provider database are
accessed. For instance if I try to access roles in either the application
or the utility I get the error pasted below.

#1 can anyone tell my why this is happening and #2 how are we supposed to
deploy apps with the ASPNETDB.MDF database?

The following message may help in diagnosing the problem: Cannot open user
default database. Login failed. Login failed for user
'DEVSERVER2003\Administrator'. at
System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean
isMembership, String methodName, Object[] parameters, Type[] paramTypes)
at ASP.security_roles_manageallroles_aspx.BindGrid() at
ASP.security_roles_manageallroles_aspx.Page_Load() at
System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

thanks,
Gary
 
S

Steven Cheng[MSFT]

Hi Sloan,

From Gary's initial message, it seems he has registered a new membership
provider entry and use its own connectionstring, therefore, I don't think
the problem is caused by the default "LocalSqlServer" connection string.
How do you think?

Hi Gary,

At the end of your last message, you said that the problem just occur when
you try accessing roles (in both code or the admin site page), I think the
problem is likely caused by the "Role manager" provider setting. For
ASP.NET 2.0 membership &role manager service, they use separate provider,
one for membership(user accounts) and another for role manager(for roles).
In your message, I think what you've changed is the default provider for
the membership service, you may still need to override the "role manager"
setting so as to make it also use your new SQL server standard instance and
database.

Here are some web articles mentioned the configuration for Rolemanager
provider, you can try customize your role provider setting acorrding to it:

#providers Element for roleManager (ASP.NET Settings Schema)
http://msdn2.microsoft.com/en-us/library/ms164661.aspx

#Membership and Role Providers in ASP.NET 2.0 Part II
http://www.odetocode.com/Articles/428.aspx

#How To: Use Role Manager in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms998314.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

sloan

Ahh.
Yeah. You have to "override" the defaults for both the Membership and Roles
provider.

..........

Also check the "integrated security" issue, with the mdf.

Source=DEVSERVER2003;Initial Catalog=PTPSecurity;Integrated Security=True"


And make sure you know which account the webpage is running under, aka, if
that account has privs on that particuliar database.


Gary, did you get your issue resolved?
 
G

GaryDean

Steven:
I found a solution that appears to be working by combining suggestions from
multiple sources. Previously I had been trying to simply attach the
SQLServerExpress ASPNETDB to my SQLServer 2005 instance, rename it and put
the follwing into my web.config...

<membership defaultProvider="SqlProvider">
<providers>
<clear />
<add connectionStringName="AUTHConnectionString" applicationName="/"
name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

And that just didn't work as I documented earlier.

I achieved a solution by provisioning a new applications services database
with the aspnet_regsql.exe utility as suggested in the ScottGu's Blog that
Sloan suggested and then putting the following in my <connectionstrings>
section.....
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data
Source=DEVSERVER2003;Initial Catalog=PTPSecurity;Integrated Security=True"
providerName="System.Data.SqlClient"/>
<remove name="SqlRoleManager"/>
<add name="SqlRoleManager" connectionString="Data
Source=DEVSERVER2003;Initial Catalog=PTPSecurity;Integrated Security=True"
providerName="System.Data.SqlClient"/>

Now everything is working fine.

Thanks for your help.
Gary
 
G

GaryDean

Sloan:
If you are interested in the solution I found (with your help) please see my
response to Seven on this thread.
Thanks for the help
Gary
 
S

Steven Cheng[MSFT]

That sounds good.

Thanks for coming back and letting us know the result.

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top