I have an ASP.NET Core app that uses Identity. It works, but when I am trying to add custom roles to the database I run into problems.
In Startup ConfigureServ
I was having this issue
No service for type 'Microsoft.AspNetCore.Identity.RoleManager`
And this page was the first result on Google. It did not answer my question, so I thought I would put my solution here, for anyone else that may be having this problem.
ASP.NET Core 2.2
The missing line for me was .AddRoles() in the Startup.cs file.
services.AddDefaultIdentity()
.AddRoles()
.AddDefaultUI(UIFramework.Bootstrap4)
.AddEntityFrameworkStores();
Hope this helps someone
Source: https://docs.microsoft.com/en-us/aspnet/core/security/authorization/roles?view=aspnetcore-2.2 (at the bottom)