Tutorial :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)


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.


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


have you ever test this configration (not just membership, I mean entire application configuration) on another machine ?

and are you sure that your application meet all of the Commerce Server requirements ? finally I recommand to install you commerce server on a virtual machine from the baseanconfiure it as you configure for the first time ( do not copy configuration file- ceae a new one ) and test if there is an error or not ? if your problem resolved (replace you currentconfiguration file with virtual machine configuration file,

if your error still remains, it means that your comfiguration have problem and you should change it.

let me know what's happen after reinstalling in another (virtual) machine.


I ran into a similar issue before. The issue was due to using an InProc session state with multiple web servers. When one application wen't offline, the load balancer tried to forward all the sessions to a new server. The new server did not have the sessions from these users so we got an Object Not Set to... error when the Membership Provider tried to access the session object.

To fix the issue, we set up a SQL Server to manage the sessions. You can see how to do that here.


Doesn't the type as specified in the web.config at


have to follow the convention as specified in the documentation to System.Type.GetType(string typeName), i.e. doesn't it have to include the assembly and maybe also version number and all that jazz? As in at least something like:

type="Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipProvider, Microsoft.FancyCommerceServerAssembly"  

or even

type="Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipProvider, Microsoft.FancyCommerceServerAssembly, Version=, Culture=neutral, PublicKeyToken=..."  


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »