未找到 HTTP 错误 404.15 - 标识 2

HTTP Error 404.15 not found - Identity 2

我正在尝试在 ASP.Net MVC 5 网络应用程序中使用 ASP.Net Identity 2

当我 运行 我的应用程序时,我有以下屏幕:

Startup.Auth.css

     public void ConfigureAuth(IAppBuilder app)
    {
        app.CreatePerOwinContext(ApplicationDbContext.Create);
        app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
        app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);

        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Home/Login"),
            Provider = new CookieAuthenticationProvider
            {
                OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                    validateInterval: TimeSpan.FromMinutes(10),
                    regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
            }
        });
        app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

        app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));

        app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
    }

我在登录操作中有一个中断点,但没有任何调用。当我禁用 StartUp.Auth class 中的代码时,应用程序 运行s 但身份验证停止工作。

不知道是什么问题。我有另一个应用程序 运行 具有相同的功能。

这是生成的 URL:

 http://localhost:23928/Home/Login?ReturnUrl=%2FHome%2FLogin%3FReturnUrl%3D%252FHome%252FLogin%253FReturnUrl%253D%25252FHome%25252FLogin%25253FReturnUrl%25253D%2525252FHome%2525252FLogin%2525253FReturnUrl%2525253D%252525252FHome%252525252FLogin%252525253FReturnUrl%252525253D%25252525252FHome%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252FHome%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525252FHome%252525252525252FLogin%252525252525253FReturnUrl%252525252525253D%25252525252525252FHome%25252525252525252FLogin%25252525252525253FReturnUrl%25252525252525253D%2525252525252525252FHome%2525252525252525252FLogin%2525252525252525253FReturnUrl%2525252525252525253D%252525252525252525252FHome%252525252525252525252FLogin%252525252525252525253FReturnUrl%252525252525252525253D%25252525252525252525252FHome%25252525252525252525252FLogin%25252525252525252525253FReturnUrl%25252525252525252525253D%2525252525252525252525252FHome%2525252525252525252525252FLogin%2525252525252525252525253FReturnUrl%2525252525252525252525253D%252525252525252525252525252FHome%252525252525252525252525252FLogin%252525252525252525252525253FReturnUrl%252525252525252525252525253D%25252525252525252525252525252FHome%25252525252525252525252525252FLogin%25252525252525252525252525253FReturnUrl%25252525252525252525252525253D%2525252525252525252525252525252FHome%2525252525252525252525252525252FLogin%2525252525252525252525252525253FReturnUrl%2525252525252525252525252525253D%252525252525252525252525252525252FHome%252525252525252525252525252525252FLogin%252525252525252525252525252525253FReturnUrl%252525252525252525252525252525253D%25252525252525252525252525252525252FHome%25252525252525252525252525252525252FLogin%25252525252525252525252525252525253FReturnUrl%25252525252525252525252525252525253D%2525252525252525252525252525252525252FHome%2525252525252525252525252525252525252FLogin%2525252525252525252525252525252525253FReturnUrl%2525252525252525252525252525252525253D%252525252525252525252525252525252525252FHome%252525252525252525252525252525252525252FLogin%252525252525252525252525252525252525253FReturnUrl%252525252525252525252525252525252525253D%25252525252525252525252525252525252525252FHome%25252525252525252525252525252525252525252F

我终于解决了这个问题。我启用了 Windows 身份验证。

打开右侧的'Properties'面板

将'Windows Authentication'设置为'Disabled'

将'Anonymous Authentication'设置为'Enabled'