I\'ve created a test project using:
dotnet new razor --auth Individual --output Test
This creates a Startup.cs that contains:
p
I also fought with this problem a while ago. I couldn't make roles to work.
In my project I used ASP.NET Core 2.1 (it could be fixed in 2.2, see link) and also scaffolded some pages.
After long searches on the internet I found this solution (which is also mentioned above in Issue 1813)
The solution was for me (as proposed in the article) to add the following line with IUserClaimsPrincipalFactory:
services.AddScoped,
UserClaimsPrincipalFactory>();
services.AddDefaultIdentity()
.AddRoles()
.AddRoleManager>()
.AddDefaultTokenProviders()
.AddEntityFrameworkStores();