Store does not implement IUserRoleStore ASP.NET Core Identity

In Startup.cs, I was missing AddRoles so

services.AddDefaultIdentity<PortalUser>()
    .AddEntityFrameworkStores<ApplicationDbContext>();

should be

services.AddDefaultIdentity<PortalUser>()
    .AddRoles<IdentityRole>()
    .AddEntityFrameworkStores<ApplicationDbContext>();

Note: The order is critical. AddRoles must come before AddEntityFrameworkStores

Leave a Comment