Ich versuche, die Anweisungen zu befolgen here Cookie-Authentifizierung auf meiner Website hinzuzufügen.InvalidOperationException: Nein IAuthenticationSignInHandler konfiguriert ist für das Schema zu behandeln melden Sie sich an: MyCookieAuthenticationScheme
Bisher habe ich hinzugefügt folgendes:
Invoke the UseAuthentication method in the Configure method of the Startup.cs file:
app.UseAuthentication();
Invoke the AddAuthentication and AddCookie methods in the ConfigureServices method of the Startup.cs file:
services.AddAuthentication("MyCookieAuthenticationScheme")
.AddCookie(options => {
options.AccessDeniedPath = "/Account/Forbidden/";
options.LoginPath = "/Account/Unauthorized/";
});
In meinem Login-Code Ich habe dann
await HttpContext.SignInAsync("MyCookieAuthenticationScheme", principal);
principle
ein ClaimsPrincipal
ist.
Als ich auf meiner Website einloggen und die Zeile nennen oben ich den Fehler:
InvalidOperationException: No IAuthenticationSignInHandler is configured to handle sign in for the scheme: MyCookieAuthenticationScheme
Was habe ich verpasst?
Vielen Dank! Ich habe den ganzen Tag versucht, das herauszufinden. Viele Beispiele da draußen, aber sie vermissen den Authentifizierungshandler. – Tom