IIS Express 配置Windows身份验证

1. 修改IIS Express配置(目录:“C:\Users\[UserName]\Documents\IISExpress\config”, 文件:applicationhost.config)

2. 修改配置文件中5个节点属性,如下代码段。

             ......
        <sectionGroup name="security"> <section name="access" overrideModeDefault="Deny" /> <section name="applicationDependencies" overrideModeDefault="Deny" /> <sectionGroup name="authentication"> <!--[1/5] Change the property with 'overrideModeDefault' from 'Deny' to 'Allow'.--> <section name="anonymousAuthentication" overrideModeDefault="Allow" /> <section name="basicAuthentication" overrideModeDefault="Deny" /> <section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" /> <section name="digestAuthentication" overrideModeDefault="Deny" /> <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" /> <!--[2/5] Change the property with 'overrideModeDefault' from 'Deny' to 'Allow'.--> <section name="windowsAuthentication" overrideModeDefault="Allow" /> </sectionGroup> <section name="authorization" overrideModeDefault="Allow" /> <section name="ipSecurity" overrideModeDefault="Deny" /> <section name="dynamicIpSecurity" overrideModeDefault="Deny" /> <section name="isapiCgiRestriction" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> <section name="requestFiltering" overrideModeDefault="Allow" /> </sectionGroup>
......
            ......
<authentication> <!--[3/5] Change the property with 'enabled' from 'true' to 'false'.--> <anonymousAuthentication enabled="false" userName="" /> <basicAuthentication enabled="false" /> <clientCertificateMappingAuthentication enabled="false" /> <digestAuthentication enabled="false" /> <iisClientCertificateMappingAuthentication enabled="false"> </iisClientCertificateMappingAuthentication> <!--[4/5] Change the property with 'enabled' from 'false' to 'true'.--> <windowsAuthentication enabled="true"> <providers> <add value="Negotiate" /> <add value="NTLM" /> </providers> </windowsAuthentication> </authentication>
       ......
......
<system.webServer>
            <modules>
                <add name="IsapiFilterModule" lockItem="true" />
                <add name="BasicAuthenticationModule" lockItem="true" />
                <add name="IsapiModule" lockItem="true" />
                <add name="HttpLoggingModule" lockItem="true" />
                <add name="DynamicCompressionModule" lockItem="true" />
                <add name="StaticCompressionModule" lockItem="true" />
                <add name="DefaultDocumentModule" lockItem="true" />
                <add name="DirectoryListingModule" lockItem="true" />
                <add name="ProtocolSupportModule" lockItem="true" />
                <add name="HttpRedirectionModule" lockItem="true" />
                <add name="ServerSideIncludeModule" lockItem="true" />
                <add name="StaticFileModule" lockItem="true" />
                <add name="AnonymousAuthenticationModule" lockItem="true" />
                <add name="CertificateMappingAuthenticationModule" lockItem="true" />
                <add name="UrlAuthorizationModule" lockItem="true" />
                <!--[5/5] Change the property with 'lockItem' from 'true' to 'false'.-->
                <add name="WindowsAuthenticationModule" lockItem="false" />
                <add name="IISCertificateMappingAuthenticationModule" lockItem="true" />
                <add name="WebMatrixSupportModule" lockItem="true" />
                <add name="IpRestrictionModule" lockItem="true" />
......

3. Web.config的改动。(注:通过修改以上配置后,站点访问仍然报IIS Error: 500.19错误,目前临时处理方案是在Dev环境临时将web.config中的节点<security>注释掉。)

4. 其它:如果修改配置后仍不行,尝试重新电脑。

 

posted @ 2020-07-15 11:05  【舍予】  阅读(900)  评论(0)    收藏  举报