這對於我在IIS7.5 64位上運行.Net 3.5 SP1的問題(我嘗試強制32位,但得到了相同的結果)。如何使用WCF和自定義ASP.NET成員資格提供程序調試「無法找到默認成員資格提供程序」錯誤?
我有一個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網站。
有什麼想法?
什麼不是你的自定義提供商的工作?我有這個問題。類型和程序集名稱在.config中被三重檢查爲正確,但我得到這個錯誤。我想我需要檢查Fusion日誌,由於某些環境問題加載(例如不可用的依賴關係),程序集未能加載。 – 2011-09-21 21:34:47
自定義MembershipProvider類對構造函數的調用失敗,但收到的錯誤是「找不到默認的成員資格提供程序」 – JTew 2011-09-21 23:04:32