如何禁用IIS表示所有身份验证?

时间:2016-12-16 11:31:29

标签: iis iis-express

对于Windows 7上的IIS express 8.0,我在applicationhost.config文件中设置了有关身份验证设置的信息。

    <authentication>

        <anonymousAuthentication enabled="false" />

        <basicAuthentication enabled="false" />

        <clientCertificateMappingAuthentication enabled="false" />

        <digestAuthentication enabled="false" />

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

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

当我&lt; windowsAuthentication enabled="true"&gt;时,我有一个弹出框提示Windows帐户和密码。我进入并且很好。

但是,我想禁用所有身份验证,因为这是在内部使用的。所以,我先禁用了windowsAuthentication。然后尝试&lt; anonymousAuthentication enabled="true" /&gt;,我得到401.2错误和消息&#34; 访问被拒绝&#34;。如果我更改为&lt; anonymousAuthentication enabled="false" /&gt;,我会收到相同的401.2错误,但浏览器会显示不同的更多行:

HTTP Error 401.2 - Unauthorized
You are not authorized to view this page due to invalid authentication headers.
Most likely causes:
•No authentication protocol (including anonymous) is selected in IIS.
•Only integrated authentication is enabled, and a client browser was used that does not support integrated authentication.
•Integrated authentication is enabled and the request was sent through a proxy that changed the authentication headers before they reach the Web server.
•The Web server is not configured for anonymous access and a required authorization header was not received.
•The "configuration/system.webServer/authorization" configuration section may be explicitly denying the user access.
Things you can try:
•Verify the authentication setting for the resource and then try requesting the resource using that authentication method.
•Verify that the client browser supports Integrated authentication.
•Verify that the request is not going through a proxy when Integrated authentication is used.
•Verify that the user is not explicitly denied access in the "configuration/system.webServer/authorization" configuration section.
•Check the failed request tracing logs for additional information about this error. For more information, click here. 
More Information:
This error occurs when the WWW-Authenticate header sent to the Web server is not supported by the server configuration. Check the authentication method for the resource, and verify which authentication method the client used. The error occurs when the authentication methods are different. To determine which type of authentication the client is using, check the authentication settings for the client. 
View more information »

我该怎么办?我想访问该页面而不进行任何身份验证。

1 个答案:

答案 0 :(得分:0)

我解决了。 在&lt; {{}}&gt;之后&lt; windowsAuthentication enabled="false" /&gt ;,我在网上发现了另一个我以前不知道的配置,即web.config。我的web.config中的行:

&lt; anonymousAuthentication enabled="true" /&gt;

我将其更改为:&lt; deny users="?" /&gt;

现在,一切都很好。