应用重启后首次初始​​化 Membership.Provider 时出现错误

发布于 2024-08-16 06:49:07 字数 3201 浏览 2 评论 0原文

我们使用 MS Commerce Server 的 Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipProvider ,有时在应用程序重新启动后首次初始​​化时,我们会收到此错误:

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()
   ...

第 425 行是会员提供程序规范:

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

我们进行了内存转储,这就是我们得到的结果:

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())
...

以前有人遇到过类似的事情吗?它不会在每次应用程序重新启动时发生,并且它似乎不在一台特定服务器上(站点在负载平衡器后面的多台服务器上运行)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

七婞 2024-08-23 06:49:07

我在 ASP.NET 中使用 SQL 成员资格提供程序时遇到了同样的问题。

这是一个配置问题。某些参数设置不正确。

也许这篇文章会对您有所帮助。

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

我能想到的(此时此刻)是你的 type 属性有问题,或者也许您没有将所有必需的依赖项复制到您的 Bin 中。

祝您好运

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

小苏打饼 2024-08-23 06:49:07

您是否曾经在另一台计算机上测试过此配置(不仅仅是成员资格,我指的是整个应用程序配置)?

您确定您的应用程序满足所有 Commerce Server 要求吗?
最后,我建议您从基础上在虚拟机上安装商务服务器,并在第一次配置时对其进行配置(不要复制配置文件 - ceae 一个新的)并测试是否有错误?如果您的问题解决了(用虚拟机配置文件替换您当前的配置文件,

如果错误仍然存​​在,则意味着您的配置有问题,您应该更改它。

让我知道在另一台(虚拟)机器中重新安装后会发生什么情况。

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.

流殇 2024-08-23 06:49:07

我之前遇到过类似的问题。该问题是由于对多个 Web 服务器使用 InProc 会话状态造成的。当一个应用程序未脱机时,负载均衡器会尝试将所有会话转发到一台新服务器。新服务器没有来自这些用户的会话,因此当成员资格提供程序尝试访问会话对象时,我们收到对象未设置为...错误。

为了解决这个问题,我们设置了一个 SQL Server 来管理会话。您可以在此处了解如何执行此操作。

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.

喜你已久 2024-08-23 06:49:07

web.config 中指定的类型是否

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

必须遵循 System.Type.GetType(string typeName) 文档中指定的约定,即它不必包含程序集,也许还有版本号和所有那些爵士乐?至少像这样:

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

或者甚至

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

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

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

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=6.6.6.0, Culture=neutral, PublicKeyToken=..."

?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文