我试图更改身份的默认ID,但确实更改了ID,而不是使用AddIdentity,而是使用AddIdenityCore并指定了 默认身份验证方案以及默认登录和注销方案
但是我得到了这个消息,从该注册方法注册和登录时没有配置IAuthenticationSignInHandler错误。
等待_signInManager.SignInAsync(user,isPersistent:false); ->发生错误
IdentityBuilder builder = services.AddIdentityCore<ApplicationUser>(options =>
{
options.Lockout.MaxFailedAccessAttempts = 3;
options.SignIn.RequireConfirmedEmail = true;
options.User.RequireUniqueEmail = true;
});
builder = new IdentityBuilder(builder.UserType, typeof(ApplicationRole), builder.Services);
builder.AddEntityFrameworkStores<ApplicationDbContext>()
.AddRoleValidator<RoleValidator<ApplicationRole>>()
.AddRoleManager<RoleManager<ApplicationRole>>()
.AddSignInManager<SignInManager<ApplicationUser>>()
.AddDefaultTokenProviders();
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignOutScheme = IdentityConstants.ExternalScheme;
}).AddCookie(CookieAuthenticationDefaults.AuthenticationScheme,
options =>
{
options.Cookie.HttpOnly = true;
options.LoginPath = new PathString("/user/account/login");
options.AccessDeniedPath = new PathString("/user/account/accessdenied");
});