Default role provider not found on IIS 7 with .NET 4

Good morning,

I am trying to implement my custom membership providers and roles in my web application, which I implemented on the default website in my IIS 7 instance. My web application runs under the .NET 4 application pool.

However, after setting up the appropriate web.config, I get the following error:

Parser Error Message: Default Role Provider could not be found. 

I have included the following block of code in the system.web section of the corresponding web.config web application:

 <membership defaultProvider="CustomMembershipProvider" userIsOnlineTimeWindow="20"> <providers> <clear/> <add name="CustomMembershipProvider" type="CustomProviders.CustomMembershipProvider, CustomProviders, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3563615169617648" applicationName="/"/> </providers> </membership> <roleManager enabled="true" defaultProvider="CustomRoleProvider"> <providers> <clear/> <add name="CustomRoleProvider" type="CustomProviders.CustomRoleProvider, CustomProviders, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3563615169617648" applicationName="/"/> </providers> </roleManager> 

Now I have seen all kinds of explanations regarding how to solve the error that I mentioned earlier. Most of them seem to suggest adding tags to my provider blocks. Some people think that I am removing the role manager from machine.config . And some seem to suggest not deleting or adding anything. This last approach does not seem to take into account that my web application is starting from IIS and not the local machine.

In the end, I tried these approaches to a minimum. Can someone please explain to me how can I get through this error? Thanks in advance!

+3
source share
3 answers

I got this error when using the default MVC web application. I had to add the following to web.config and the error went away. In the <system.webServer> section add

 <modules> <remove name="RoleManager"/> </modules> 
+12
source

Two things:

enabled="false" must be enabled="true"

And I'm not sure if applicationName="/" is useful, but it might not hurt.

0
source

I got this error message when adding an application in IIS 8 to our existing website (right-click on the website in IIS, select "Add Application"). The web.config application had only the default tag, which removed the default provider, which was defined by the web.config website.

I completely removed the RoleManager tags from the web.config application, and then the website and application started working properly.

0
source

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


All Articles