如果在ASP.NET Core MVC应用程序中遇到身份验证问题,则需要执行以下操作检查并解决问题:
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => { options.LoginPath = "/Account/Login"; options.LogoutPath = "/Account/Logout"; });
app.UseAuthentication();
[Authorize] public class HomeController : Controller { //... }
如果问题仍然存在,您可以在管理后台配置中查看身份验证日志以获取更多信息。