Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 来自不同web应用的.NET Core 3 UserManager/IdentityUser问题_C#_Razor_Asp.net Identity_Core - Fatal编程技术网

C# 来自不同web应用的.NET Core 3 UserManager/IdentityUser问题

C# 来自不同web应用的.NET Core 3 UserManager/IdentityUser问题,c#,razor,asp.net-identity,core,C#,Razor,Asp.net Identity,Core,我有两个内置在.NETCore3.1中的web应用程序,带有razor页面。 第一个具有在Startup.cs中初始化的用于身份验证的标准net core标识 services.AddDefaultIdentity<IdentityUser>(options => { options.User.RequireUniqueEmail = true; options.SignIn.RequireConf

我有两个内置在.NETCore3.1中的web应用程序,带有razor页面。 第一个具有在Startup.cs中初始化的用于身份验证的标准net core标识

        services.AddDefaultIdentity<IdentityUser>(options =>
        {
            options.User.RequireUniqueEmail = true;
            options.SignIn.RequireConfirmedAccount = true;
            options.SignIn.RequireConfirmedEmail = true;
        })
            .AddRoles<IdentityRole>()
            .AddEntityFrameworkStores<context>();
这两个应用共享同一个数据库

        services.AddDbContext<context>(options =>
             options.UseSqlServer(
                 Configuration.GetConnectionString("DefaultConnection")));
但如果我尝试更改密码、ResetPasswordAsync或GeneratePasswordResetTokenAsync之类的操作,我总是会遇到如下错误:

An unhandled exception occurred while processing the request.
NotSupportedException: No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.
处理请求时发生未处理的异常。
NotSupportedException:未注册名为“Default”的IUSERTwoFactoryTokenProvider。
我不明白的是我是否遗漏了什么或者我的方法完全错误

 UserManager<IdentityUser> userManager = 
 new UserManager<IdentityUser>(
 new UserStore<IdentityUser>(context);,
 identityOptions, //same of startup.cs from first site
 new PasswordHasher<IdentityUser>(),
 new List<UserValidator<IdentityUser>>() {​​ new UserValidator<IdentityUser>() }​​,
 new List<PasswordValidator<IdentityUser>>() {​​ new PasswordValidator<IdentityUser>() }​​,
 new UpperInvariantLookupNormalizer(),
 new IdentityErrorDescriber(),
 null,
 null);
var user = await userManager.FindByIdAsync(SOMEID);
An unhandled exception occurred while processing the request.
NotSupportedException: No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.