【发布时间】:2019-12-18 02:51:38
【问题描述】:
我创建了一个继承IdentityUser 的ApplicationUser 类,然后在StartUp 类中,我将services.AddDefaultIdentiy 泛型类型从IdentityUser 更改为ApplicationUser,这样我就可以获得UserManager<ApplicationUser> 的服务而不是UserManager<IdentityUser>。
services.AddDefaultIdentity<ApplicationUser>()
.AddDefaultUI(UIFramework.Bootstrap4)
.AddEntityFrameworkStores<ApplicationDbContext>();
我收到了这个错误
InvalidOperationException:没有注册类型“Microsoft.AspNetCore.Identity.UserManager`1[Microsoft.AspNetCore.Identity.IdentityUser]”的服务。
我无法向服务中添加两个默认身份,我需要有关如何解决此问题的帮助
【问题讨论】:
标签: asp.net-core asp.net-identity asp.net-core-2.2