The Role Manager feature has not been enabled

后端 未结 7 812
再見小時候
再見小時候 2020-12-04 11:50

Got the following ProviderException :

The Role Manager feature has not been enabled.

So far so good.

Is there somewher

7条回答
  •  死守一世寂寞
    2020-12-04 12:18

    I found this question due the exception mentioned in it. My Web.Config didn't have any tag. I realized that even if I added it (as Infotekka suggested), it ended up in a Database exception. After following the suggestions in the other answers in here, none fully solved the problem.

    Since these Web.Config tags can be automatically generated, it felt wrong to solve it by manually adding them. If you are in a similar case, undo all the changes you made to Web.Config and in Visual Studio:

    1. Press Ctrl+Q, type nuget and click on "Manage NuGet Packages";
    2. Press Ctrl+E, type providers and in the list it should show up "Microsoft ASP.NET Universal Providers Core Libraries" and "Microsoft ASP.NET Universal Providers for LocalDB" (both created by Microsoft);
    3. Click on the Install button in both of them and close the NuGet window;
    4. Check your Web.config and now you should have at least one tag inside Profile, Membership, SessionState tags and also inside the new RoleManager tag, like this:

      
          
             
          
      
      
    5. Add enabled="true" like so:

      
      
    6. Press F6 to Build and now it should be OK to proceed to a database update without having that exception:

      1. Press Ctrl+Q, type manager, click on "Package Manager Console";
      2. Type update-database -verbose and the Seed method will run just fine (if you haven't messed elsewhere) and create a few tables in your Database;
      3. Press Ctrl+W+L to open the Server Explorer and you should be able to check in Data Connections > DefaultConnection > Tables the Roles and UsersInRoles tables among the newly created tables!

提交回复
热议问题