Question

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!

Was it helpful?

Solution

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>

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top