1

当我将 defaultPath="/Error.aspx" 添加到我的 Web 配置时,我收到一个错误,告诉我我的配置有错误。问题是,没有它,一切都会顺利进行,没有错误。我有以下一些相关设置:

<httpErrors defaultResponseMode="ExecuteURL" errorMode="Custom" existingResponse="Replace" >
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/Err.aspx" responseMode="ExecuteURL" />
        </httpErrors>
<customErrors mode="On" defaultRedirect="~/Error.aspx" redirectMode="ResponseRewrite">
        <error statusCode="404" redirect="~/Err.aspx" />
    </customErrors>

你能帮我吗。你知道当我尝试添加默认路径时 iis 会出错吗?

4

1 回答 1

0

只有在 IIS 的文件 applicationHost.config 中设置“defaultPath”时,我才能解决此错误。

或者您可以使用以下步骤使用 UI 进行设置:
1) 打开 IIS
2) 选择 ServerName(不是网站)
3) 打开菜单“错误页面”
4) 单击左侧的“编辑功能设置”。
5)在弹出窗口中配置设置“路径”和其他选项。

于 2014-01-08T12:42:32.763 回答