首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在IIS 7中:如何设置任何错误的默认错误文档

在IIS 7中:如何设置任何错误的默认错误文档
EN

Server Fault用户
提问于 2009-08-13 12:53:04
回答 3查看 10.8K关注 0票数 3

我想用户'error.html‘的任何错误IIS可能遇到。

如果我在webconfig中声明以下块,则站点拒绝运行。

代码语言:javascript
运行
复制
<httpErrors errorMode="DetailedLocalOnly" existingResponse="Replace" defaultPath="/error.html" defaultResponseMode="ExecuteURL">
    <remove statusCode="500" subStatusCode="-1" />
    <remove statusCode="404" subStatusCode="-1" />
    <remove statusCode="403" subStatusCode="-1" />
    <remove statusCode="401" subStatusCode="-1" />
    <error statusCode="401" prefixLanguageFilePath="" path="/401.html" responseMode="ExecuteURL" />
    <error statusCode="403" prefixLanguageFilePath="" path="/403.html" responseMode="ExecuteURL" />
    <error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" />
    <error statusCode="500" prefixLanguageFilePath="" path="/500.html" responseMode="ExecuteURL" />
</httpErrors>

注意根元素中的属性defaultPath="/error.html“。

我得到了以下错误

HTTP-Fehler 500.19 -内部服务器错误

..。

Konfigurationsfehler: Sperrverletzung

..。

EN

回答 3

Server Fault用户

回答已采纳

发布于 2009-08-13 12:54:07

编辑%windir%\system32\inetsrv\config\applicationHost.config

设置线路:

代码语言:javascript
运行
复制
<httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">

至:

代码语言:javascript
运行
复制
<httpErrors lockAttributes="allowAbsolutePathsWhenDelegated">
票数 4
EN

Server Fault用户

发布于 2009-08-27 15:05:56

尝试使用IIS 7管理器正确设置此设置。另外,你也可以这样做:

代码语言:javascript
运行
复制
<system.web>
    <customErrors mode="On" defaultRedirect="~/error.html">
    </customErrors>
</system.web>
票数 1
EN

Server Fault用户

发布于 2017-01-04 08:39:52

除了Fabian的回答之外,您还可以在以下文件中找到该文件:

解决方案文件夹-> .vs (通常此文件夹是隐藏的) -> config

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/53712

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档