How can I debug the “Member Member Provider Provider could not be found” error with WCF and ASP.NET custom provider?

This is a problem for me with .NET 3.5 Service Pack 1 (SP1) running on 64-bit IIS7.5 (I tried to force 32-bit but got the same result).

I have a WCF service with which I want to use authentication services. When I have no behavior, the WCF service draws (responds) without any errors. Other services also work with other types of behavior.

As soon as I add userNameAuthentication to the behavior defining the user MemberhipProvider for authentication for the service ...

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

The service explodes and returns the following error:

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

The event log has this error:

  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) 

I am sure that this is not a problem with the configuration of the provider or provider, as I have this custom provider working with the ASP MVC site.

Any thoughts?

+4
source share
3 answers

I started a new implementation of Custom Provider from scratch, ensuring that all overrides were correctly returned. My original one, which I thought worked (this was a couple of months ago), and it turned out that it no longer works.

It turns out if you have the provider name correctly, and the type is correct in the configuration, which only leaves the custom provider implementation.

So, if you have this problem and you are sure that your configuration is correct, check your implementation on the simple ASP.net or ASP.net MVC website.

+2
source

I got this error and eventually found that hidden UTF8 or Unicode characters got into my web.config file. I had to delete partitions to find out that the application strings section is corrupt.

As soon as I replaced it with an earlier version, it worked again. Some of the lines had extra space in them that was suspicious, I'm not sure if this could be from cutting and pasting or what. You can also try looking at your web.config file with a hex editor.

+1
source

I had the same problem and spent almost a week on it. My problem was that I had to override the Name property with the same value that was in the name of the web.config provider. I hate it when the simplest solutions are so hard to find!

+1
source

Source: https://habr.com/ru/post/1302228/


All Articles