web.config自定义httpErrors不重定向..."由于发生内部服务器错误,无法显示页面。"代替

时间:2017-01-03 03:31:19

标签: iis-7 web-config http-status-code-404 http-error

我试图让自定义错误页面起作用无济于事。此配置改编自我在网上找到的样本。使用GoDaddy托管的IIS 7.0。

以下代码告诉我"由于发生内部服务器错误,无法显示页面。"而不是重定向。

<configuration>  
    <system.webServer>

        <httpErrors>
        <remove statusCode="401" subStatusCode="-1" />
        <remove statusCode="403" subStatusCode="-1" />      
        <remove statusCode="404" subStatusCode="-1" />                
        <remove statusCode="500" subStatusCode="-1" />
        <error statusCode="401" path="http://www.mywebsite.com/error.html" responseMode="Redirect" />
        <error statusCode="403" path="http://www.mywebsite.com/error.html" responseMode="Redirect" />
        <error statusCode="404" path="http://www.mywebsite.com/error.html" responseMode="Redirect" />                
        <error statusCode="500" path="http://www.mywebsite.com/error.html" responseMode="Redirect" />
      </httpErrors>

    </system.webServer>

     <system.web>
        <customErrors mode="On"/>
    </system.web>

</configuration>

0 个答案:

没有答案