为什么我的 MVC5 应用程序在我删除 Windows Auth 时提示我输入 Windows Auth?

Why is my MVC5 App prompting me for Windows Auth when I removed Windows Auth?

我有一个之前使用 AD 进行身份验证的 MVC 5 应用程序。我已经删除了 windows 身份验证的设置并添加了代码以针对用户数据库手动进行身份验证。

问题是 AD 身份验证 window 继续弹出,我需要输入有效凭据才能访问任何表单。这不是我想要的、预期的,或者在我能找到的任何地方的代码中。

我在任何方法控制器上都没有授权标签。我还没有对任何表单进行安全设置,没有任何允许或拒绝配置设置。我无法弄清楚为什么每个表单都会弹出 AD 身份验证 window,以及为什么如果我单击取消我就无法访问我的任何表单而不再次弹出。

配置文件:

<authentication mode="Forms">
  <forms name=".ASPXAUTH" loginUrl="~/Account/Login" timeout="300" slidingExpiration="true" protection="All" />
</authentication>

我查看了我的控制器、视图和 global/statup .cs 文件。现在没有任何线索给我。

我可以展示任何代码片段,但我不确定此时什么是相关的。

下面是我的 applicationhost.config IISExpress 设置文件,它似乎也已正确设置...

   <authentication>

        <anonymousAuthentication enabled="true" userName="" />

        <basicAuthentication enabled="false" />

        <clientCertificateMappingAuthentication enabled="false" />

        <digestAuthentication enabled="false" />

        <iisClientCertificateMappingAuthentication enabled="false">
        </iisClientCertificateMappingAuthentication>

        <windowsAuthentication enabled="false">
            <providers>
                <add value="Negotiate" />
                <add value="NTLM" />
            </providers>
        </windowsAuthentication>

    </authentication>

    <authorization>
        <add accessType="Allow" users="*" />
    </authorization>

在 applicationhost.config 文件的最底部(第 1050 行)是以下设置了 windowsAuthentication enabled="true" 的数据。将其更改为 false 后,我不再为 Windows 登录提示所困扰。

<location path="myapp">
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
                <windowsAuthentication enabled="false" />
            </authentication>
        </security>
    </system.webServer>
</location>

该文件位于解决方案根文件夹中,后跟 .vs\config

This post 帮助我指明了检查该文件的方向以及 PankajKapare 关于 IIS Express 的评论。

感谢您的帮助。