28

For whatever reason, the site I was working on (after a bit of pause) begun screaming about an sql server connection for the asp.net membership. I'm using mysql without asp.net membership so it was weird. However just to be sure I've decided to remove anything related to it, including role providers.

I've added these to the web.config

 <membership>
      <providers>
          <clear />
      </providers>
  </membership>
  <roleManager enabled="false">
      <providers>
          <clear />
      </providers>
  </roleManager>
  <profile enabled="false">
      <providers>
          <clear />
      </providers>
  </profile>

However, it still throws exception: "Configuration Error, Default Role Provider could not be found." . What can I do?

MikeSW
  • 16,140
  • 3
  • 39
  • 53

1 Answers1

48

I think I found what was missing: I had to remove the RoleManager module also.

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
        <remove name="RoleManager" />
    </modules>
</system.webServer>
Rebecca
  • 13,914
  • 10
  • 95
  • 136
MikeSW
  • 16,140
  • 3
  • 39
  • 53
  • +1 Thanks! What a PITA. On IIS 8 it appears the membership/rolemanager/profile is baked into the machine.config. – Chuck Conway Sep 07 '12 at 22:50
  • 1
    +1 This also worked for me. Interesting this has never been a problem prior to me upgrading to MVC4 in production. Does anyone know why this was a problem all of the sudden? – Tri Q Tran Jan 07 '13 at 22:29
  • The RoleManager module is baked into my machine level web.config with a stock install. Removing it like above fixes the issue when doing your own custom thing for roles. – John Culviner Apr 03 '13 at 20:53
  • thanks. 3 hours of not knowing why my site fails to finally figuring out that ClaimsPrincipal.Current had a roleprovider creating a external role which made the site timeout on the sql database that was not configured. Never had to remove the RoleManager my self before. – Poul K. Sørensen Apr 13 '13 at 01:06