3
ユーザーを正常に登録し、認証を確認した後、上記のエラーが発生します。私はapp.UseMvcへの呼び出しの前にapp.UseIdentity();
を呼び出す このスキームを処理する認証ハンドラが設定されていません。Identity.Application
services.AddIdentity<ApplicationUser, IdentityRole<int>>(
config => { config.User.RequireUniqueEmail = true;
config.Cookies.ApplicationCookie.LoginPath = "/Account/Login";
config.Cookies.ApplicationCookie.Events = new CookieAuthenticationEvents()
{
OnRedirectToLogin = async ctx =>
{
if (ctx.Request.Path.StartsWithSegments("/api") && ctx.Response.StatusCode == 200)
{
ctx.Response.StatusCode = 401;
}
else
{
ctx.Response.Redirect(ctx.RedirectUri);
}
await Task.Yield();
}
};
}).AddEntityFrameworkStores<VisualJobsDbContext, int>()
.AddDefaultTokenProviders();
とスタートアップの私のコンフィグ方法で
:私は私が最初にこれをIServiceCollectionにサービスを割り当てるawait _signInManager.SignInAsync(applicationUser, isPersistent);
を呼び出そうとするとエラーが発生します
私はあることを私の呼び出しを変更した場合:
var myVal = await _signInManager.PasswordSignInAsync(applicationUser, password, true, false);
彼らは私ヴァルは、私は何らかのエラーが
のように
app.UseIdentity();
方法Configure
Startup.cs
にを追加しようとしています。最良のものに答え、残りを重複としてフラグを立てる。 http://meta.stackexchange.com/questions/104227/is-it-acceptable-to-add-a-duplicate-answer-to-several-questionsを参照してください。 –