InvalidOperationException: невозможно разрешить службу для типа «Microsoft.AspNetCore.Identity.UserManager`1 [MyWebsite.Models.User]» при попытке активировать «MyWebsite.Controllers.AccountController».
Я получаю эту ошибку при доступе / Аккаунт / Регистрация
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<IdentityUser>()
.AddDefaultUI(UIFramework.Bootstrap4)
.AddEntityFrameworkStores<ApplicationDbContext>();
//services.AddIdentity<User, IdentityRole>()
//.AddEntityFrameworkStores<ApplicationDbContext>();0
ApplicationDbContext
public class ApplicationDbContext : IdentityDbContext<User>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
Database.EnsureCreated();
}
}
Класс пользователя
public class User : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Address { get; set; }
}
Контроллер аккаунта
private readonly UserManager<User> _userManager;
private readonly SignInManager<User> _signInManager;
private readonly RoleManager<IdentityRole> _roleManager;
public AccountController(UserManager<User> userManager, SignInManager<User> signInManager, RoleManager<IdentityRole> roleManager)
{
_userManager = userManager;
_signInManager = signInManager;
_roleManager = roleManager;
}
Я новичок, помогите