首页 > 解决方案 > .NET Core 2.2 无法访问控制器但脚手架登录工作

问题描述

在此处输入图像描述

我目前无法联系到我的账户管理员。由于某些原因,我正在更换脚手架身份登录。

我的 AccountController 的当前路径是 Areas > Identity > Pages > Account > AccountController

以前是区域 > 身份 > 页面 > 帐户 > 登录

这是我的 AccountController 的顶部

[Area("Identity")]
[AllowAnonymous]
[TypeFilter(typeof(ValidateApplicationStatusFilter), Arguments = new object[] { ApplicationGlobals.DocumentStudio })]
public class AccountController : Controller

在我的 Startup.cs 中,我将登录路径设置为:

options.LoginPath = "/Identity/Account/Login";

我试图在 AccountController 中的 Login 函数上放置一个调试器,但它从未成功。当我现在登录时,它会显示一个不同的登录表单,这似乎是 .net 创建的默认表单?

标签: asp.net.netasp.net-mvcasp.net-core

解决方案


我发现了问题所在。

在 Startup.cs 中,我正在使用

services.AddDefaultIdentity

这以某种方式迫使它使用默认登录页面。当我将其更改为

services.AddIdentity

有效。


推荐阅读