When configuring Blazor Identity …

Error:

NotSupportedException: Store does not implement IUserRoleStore<TUser>.

var roles = await _signInManager.UserManager.GetRolesAsync(user);

Fix:

Add .AddRoles<IdentityRole>() to Configuration of Startup.cs

            services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
                 .AddRoles<IdentityRole>()
                .AddEntityFrameworkStores<ApplicationDbContext>();
Last modified: December 19, 2020

Author

Comments

Write a Reply or Comment