iis7 伪静态造成真实的.html不能访问

时间:2022-12-18 23:59:33

<system.webServer>
        <handlers>
            <add name="*html" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
        </handlers>
    </system.webServer>

以上配置把*.html都由%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll来解析,但这样会造成真实的.html出问题,解决方法是在web.config里加以下配置

 <compilation defaultLanguage="c#" debug="true">
            <buildProviders>
                   <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
            </buildProviders>
        </compilation>