gpt4 book ai didi

wcf - 如何使用 WCF 和自定义 ASP.NET 成员资格提供程序调试 'Default Membership Provider could not be found' 错误?

转载 作者:行者123 更新时间:2023-12-04 23:36:01 24 4
gpt4 key购买 nike

这对我来说是在 IIS7.5 64 位上运行的 .Net 3.5 SP1 的问题(我尝试强制使用 32 位,但得到了相同的结果)。

我有一个 WCF 服务,我想与它一起使用身份验证服务。当我没有任何行为时,WCF 服务会在没有任何错误的情况下绘制(回复)。其他服务也适用于其他行为

一旦我将 userNameAuthentication 添加到指定自定义 MembershipProvider 以对服务进行身份验证的行为中...

  <serviceCredentials>
<!-- Configure user name authentication to use the Membership Provider -->
<userNameAuthentication userNamePasswordValidationMode ="MembershipProvider"
membershipProviderName ="MembershipService"/>
</serviceCredentials>

服务崩溃并返回以下错误:
 Parser Error Message: Default Membership Provider could not be found.
Source Error:
Line 49: </authentication>
Line 50:
Line 51: <membership defaultProvider="MembershipService" userIsOnlineTimeWindow="15">
Line 52: <providers>
Line 53: <clear/>

事件日志有这个错误:
 WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/59884855
Exception: System.ServiceModel.ServiceActivationException: The service '/V4Service.svc' cannot be activated due to an exception during compilation. The exception message is: Default Membership Provider could not be found. (C:\Code\SmartTrade Projects\SmartTrade.API\Web\SmartTrade.API\web.config line 50). ---> System.Configuration.ConfigurationErrorsException: Default Membership Provider could not be found. (C:\Code\SmartTrade Projects\SmartTrade.API\Web\SmartTrade.API\web.config line 50)
at System.Web.Security.Membership.Initialize()
at System.Web.Security.Membership.get_Providers()
at System.ServiceModel.Configuration.UserNameServiceElement.ApplyConfiguration(UserNamePasswordServiceCredential userName)
at System.ServiceModel.Configuration.ServiceCredentialsElement.ApplyConfiguration(ServiceCredentials behavior)
at System.ServiceModel.Configuration.ServiceCredentialsElement.CreateBehavior()
at System.ServiceModel.Description.ConfigLoader.LoadBehaviors[T](ServiceModelExtensionCollectionElement`1 behaviorElement, KeyedByTypeCollection`1 behaviors, Boolean commonBehaviors)
at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress)
at System.ServiceModel.ServiceHostBase.ApplyConfiguration()
at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)

我很确定这不是提供程序或提供程序配置的问题,因为我有这个自定义提供程序与 ASP MVC 站点一起工作。

有什么想法吗?

最佳答案

我从头开始了一个新的自定义提供程序实现,以确保所有覆盖都正确返回。我原以为可以工作的(那是几个月前的),但事实证明它不再有效。

事实证明,如果您的配置中的 Provider Name 和 Type 正确,则只会留下您的 Custom Provider 实现。

因此,如果您遇到此问题并且确定您的配置正确,请使用简单的 ASP.net 或 ASP.net MVC 网站验证您的实现。

关于wcf - 如何使用 WCF 和自定义 ASP.NET 成员资格提供程序调试 'Default Membership Provider could not be found' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2325688/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com