How to fix Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager'

This post shows you how to solve System.AggregateException: 'Some services are not able to be constructed'

Inner Exceptions

InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.IRoleStore`1[Microsoft.AspNetCore.Identity.IdentityRole]' while attempting to activate 'Microsoft.AspNetCore.Identity.RoleManager`1[Microsoft.AspNetCore.Identity.IdentityRole]'.

You need to use the same user data model in SignInManagerUserManager.

Opening your Startup class, then modify your code as shown below.

services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, ApplicationRole>()
                .AddEntityFrameworkStores<ApplicationDbContext>()
                .AddCustomStores()
                .AddDefaultTokenProviders();