Default Role Provider could not be found on IIS 7 running .NET 4
Asked Answered
S

3

6

Good morning all,

I am attempting to implement my custom membership and role providers in my web application that I have implemented under the Default Web Site in my instance of IIS 7. My web application is running under a .NET 4 application pool.

However, after setting up the corresponding 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 application's web.config:

<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 sorts of explanations as to how solve the error that I mentioned earlier. Most of them seem to suggest that I add tags to my provider blocks. Some seem to suggest that I remove the role manager from the machine.config. And some still seem to suggest not removing or adding anything. This last approach does not seem to account that my web application is being run from IIS and not a local machine.

In the end, I have have tried these approaches to little avail. Can someone please explain to me how I can get passed this error? Thanks in advance!

Shaky answered 31/5, 2013 at 12:57 Comment(0)
A
19

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

<modules>
 <remove name="RoleManager"/>
</modules>
Affectional answered 27/6, 2014 at 20:22 Comment(1)
You amazing person. I was stuck on this stupid issues, just all of a sudden out of the blue. And tried so many things before this.Eldwon
B
0

Two things:

enabled="false" should probably be enabled="true"

And I'm not convinced the applicationName="/" is helpful, but it may not be hurting, either.

Bandoline answered 31/5, 2013 at 13:13 Comment(1)
Sorry the enabled attribute was copied over wrong when asking the question. Enabled is in fact set to true, and I still get the above error. As far as the applicationName, the "/" seems to be fairly common practice. I am not sure what to use alternatively.Shaky
R
0

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

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

Rosetterosewall answered 7/1, 2014 at 15:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.