问题
I am using the System.Web.Sercurity.Membership
methods to deal with users of our web service. I was very happy with it during testing as our database and web service resided on the same server.
When the database and web service where moved to separate servers we are getting a massive delay when we are authenticating users with the Membership.ValidateUser(username, password)
command.
Config file details:
type="System.Web.Providers.DefaultMembershipProvider,
System.Web.Providers, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=*********"
connectionStringName="BlaBlaConnection"
enablePasswordRetrieval="false" enablePasswordReset="true"
RequiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/"
回答1:
The issue was to do with permissions on the database box This article helped: https://elgg.leeds.ac.uk/webteam/weblog/15385.html
Our Database guy added the App Pool Identity and the Domain machine identity to the database box and .NET root directories granting read/write access.
When the servers were re-imaged the UNC paths for those directories were not on the C: drive so they didn't inherit the "normal" ACL rights
When this was corrected the timings went way down,
But it's still a bit slow for what I want (averaging about 4 seconds for Membership.ValidateUser(username, password);
and Roles.IsUserInRole(username, item.Role)
; with a load of 10,000 per hour)
来源:https://stackoverflow.com/questions/15277242/membership-validateuser-is-slow