【问题标题】:All requests getting HTTP Error 401.2 - Unauthorized response所有请求都收到 HTTP 错误 401.2 - 未经授权的响应
【发布时间】:2012-07-27 12:24:52
【问题描述】:

直到几分钟前,我的 MVC 应用程序一直运行良好(将 asp/net 成员资格作为解决方案的一部分)。但是,即使是我的家庭控制器(没有任何授权属性等),也不会故意更改与每个请求相关的任何内容。

我现在已经从 web.config 中删除了所有与授权相关的条目,并且我已经检查了 applicationhost.config,它具有以下内容:

<access sslFlags="None" />

        <applicationDependencies>
            <application name="Active Server Pages" groupId="ASP" />
        </applicationDependencies>

        <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>

任何人都可以提出可能导致这种情况的原因吗?

谢谢

关于此的更多信息,我切换到使用完整的 IIS 并且它现在工作正常,所以它看起来像是一个 IIS Express 问题。关于原因的任何线索?除了系统托盘图标,没有完整的IIS express gui吗?

【问题讨论】:

    标签: asp.net-mvc iis security iis-express


    【解决方案1】:

    选项一:

    在 applicationhost.config 中检查是否有任何条目,如下所示。如果有任何此类条目,请将启用匿名身份验证的值从“false”更改为“true”。

    <location path="YOUR-APPLICATION-NAME">
        <system.webServer>
            <security>
                <authentication>
                    <anonymousAuthentication enabled="false" />
                </authentication>
            </security>
        </system.webServer>
    </location>
    

    选项 2:

    如果您使用的是 Visual Studio,请确保启用了匿名身份验证。

    【讨论】:

    • 或者如果您想使用内置的 Active Directory 身份验证,请将“Windows 身份验证”更改为启用,并将“匿名身份验证”设为禁用。
    • 我与 Windows 身份验证 有类似的东西,并且必须在我的项目“属性”窗格中将上面的图片从 已禁用 更改为 启用和宾果游戏,很好。
    【解决方案2】:

    这违背了目的——如果您启用匿名身份验证,您将不再使用 Active Directory...这是一个更好的答案...。

    HTTP Error 401.2 - Unauthorized for new site in a working app pool

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多