Search code examples
c#asp.netmembership-providermicrosoft-commerce-server

Getting an error when initialising the Membership.Provider for the first time after an app restart


We're using MS Commerce Server's Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipProvider and sometimes where it gets initialised for the first time after an app restart we get this error:

System.Configuration.ConfigurationErrorsException - System.Web, Object reference not set to an instance of an object. (C:\Inetpub\web.config line 425)
   at System.Web.Security.Membership.Initialize()
   at System.Web.Security.Membership.get_Provider()
   ...

Line 425 is the membership provider specification :

<membership defaultProvider="UpmMembershipProvider">
  <providers>
    <clear />
    <add name="UpmMembershipProvider"
      applicationName="app"
      enablePasswordRetrieval="false"
      enablePasswordReset="true"
      logonNameProperty="GeneralInfo.logon_name"
      requiresQuestionAndAnswer="true"
      requiresUniqueEmail="true"
      enableCreateDate="true"
      enableEmailAddress="true"
      enableLastLoginDate="true"
      profileDefinition="UserObject"
      passwordFormat="Hashed"
      maxInvalidPasswordAttempts="5"
      passwordAttemptWindow="1"
      type="Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipProvider" />
  </providers>
</membership>

We took a memory dump and this is what we got:

0:025> !dumpstack
OS Thread Id: 0x1080 (25)
Current frame: kernel32!RaiseException+0x53
ChildEBP RetAddr  Caller,Callee
1213e5d8 7d4e237e kernel32!RaiseException+0x53, calling ntdll!RtlRaiseException
1213e5ec 79e8002c mscorwks!Binder::RawGetClass+0x20, calling mscorwks!Module::LookupTypeDef
1213e5fc 79e8068f mscorwks!Binder::IsClass+0x23, calling mscorwks!Binder::RawGetClass
1213e608 79ef2a0f mscorwks!Binder::IsException+0x14, calling mscorwks!Binder::IsClass
1213e618 79ef2a36 mscorwks!IsExceptionOfType+0x23, calling mscorwks!Binder::IsException
1213e620 79ef2bbc mscorwks!RaiseTheExceptionInternalOnly+0x2a8, calling kernel32!RaiseException
1213e668 79e81e3d mscorwks!SetObjectReferenceUnchecked+0x19
1213e680 79fccf80 mscorwks!JIT_Throw+0xfc, calling mscorwks!RaiseTheExceptionInternalOnly
1213e6b8 79295aea (MethodDesc 0x791aad5c +0xa System.Collections.CompatibleComparer.Equals(System.Object, System.Object)), calling (MethodDesc 0x791aad50 +0 System.Collections.CompatibleComparer.Compare(System.Object, System.Object))
1213e6d4 792e5fcd (MethodDesc 0x7910c3d0 +0xcd System.Collections.Hashtable.get_Item(System.Object))
1213e6f4 79fcced5 mscorwks!JIT_Throw+0x1e, calling mscorwks!LazyMachStateCaptureState
1213e70c 792861dc (MethodDesc 0x791a5f58 +0x1c System.RuntimeType.IsPrimitiveImpl()), calling mscorwks!TypeHandle::GetSignatureCorElementType
1213e724 7a57b600 (MethodDesc 0x7a4abadc +0x70 System.Configuration.SettingsBase.GetPropertyValueByName(System.String)), calling (MethodDesc 0x7a4ac288 +0 System.Configuration.SettingsPropertyValue.get_PropertyValue())
1213e744 66918ad7 (MethodDesc 0x65f9871c System.Web.Security.Membership.Initialize()), calling mscorwks!JIT_Throw
1213e7a0 6673ecb9 (MethodDesc 0x65f985a0 +0x5 System.Web.Security.Membership.get_Provider()), calling (MethodDesc 0x65f9871c +0 System.Web.Security.Membership.Initialize())
...

Anyone come across anything like this before? It doesn't happen every time the app restarts, and it doesn't seem to be on one particular server (site is running on multiple servers behind a load balancer)


Solution

  • I've had the same problem using the SQL Membership Provider with ASP.NET.

    It was a configuration problem. Some parameter was set incorrectly.

    Maybe this article will help you.

    http://blogs.law.harvard.edu/brandonhaynes/2008/04/27/using-commerce-servers-upmmembershipprovider-with-dotnetnuke/

    What I can think (at this moment) is that you have a problem with the type attribute, or maybe you didn't copy all of the required dependencies to your Bin..

    Good luck