若要启用该功能,托管商需要锁定除 errorMode 之外的所有属性 (lockAllAttributesExcept="errorMode"),并锁定错误元素 (lockElements="error")。 这样,客户就可以将 errorMode 从“detailedLocalOnly”更改为“Detailed”,他们将获得所有错误的详细错误信息。
若要啟用它,主機程式必須鎖定 errorMode 以外的所有屬性, (lockAllAttributesExcept=「errorMode」) ,並將錯誤元素鎖定 (lockElements=「error」) 。 如此一來,客戶可以將 errorMode 從「detailedLocalOnly」 變更為 「Detailed」,而且他們會收到所有錯誤的詳細錯誤。
若要启用该功能,托管商需要锁定除 errorMode 之外的所有属性 (lockAllAttributesExcept="errorMode"),并锁定错误元素 (lockElements="error")。 这样,客户就可以将 errorMode 从“detailedLocalOnly”更改为“Detailed”,他们将获得所有错误的详细错误信息。
<!-- Pass through Ajax Errors with status code 600 --> <httpErrors errorMode="Detailed" existingResponse="PassThrough"> <error statusCode="600" path="/" /> </httpErrors> <!--End --> 上述代码片段的问题在于,这适用于所有响应代码,因此即使代码使用500 Internal Server失败,响应也会按原样传递,...
其中,errorMode属性指示如何处理HTTP错误。详细模式(Detailed)是最详细的错误模式,它将返回一个包含服务器响应头(Status Line)和HTTP体(HTTP Body)的错误页面。在详细模式下,服务器将返回一个包含服务器响应头和HTTP体的错误页面,客户端可以查看详细的错误信息,以帮助用户诊断问题。
errorMode属性可以是下列值之一;默认值为DetailedLocalOnly。 值说明 DetailedLocalOnly如果请求来自本地计算机,则返回详细的错误信息,如果请求来自外部计算机,则返回自定义错误消息。 数值为0。 Custom将模块或服务器生成的错误替换为指定的自定义页面。 此模式可用于向最终用户提供更友好的错误消息。
errorMode有三个值,分别为Custom、DetailedLocalOnly、Detailed,意思为对用户与服务器端始终显示自定义页面、只能服务器端显示详细出错信息、对用户与服务器端始终显示详细出错信息。 responseMode有File、ExecuteUrl、Redirect三个层,分别表示使用服务器端静态文件、可执行的URL、URL转向。
<error statusCode="500" responseMode="ExecuteURL" path="/Error500" /> </httpErrors> </system.webServer> 现在如果尝试访问以下链接,将会产生对应的错误 注: 一般情况 customErrors标签上的model属性设为RemoteOnly,httpErrors上的errorModel设为DetailedLocalOnly ...
Second: Custom Error or Detailed Error The next check is determined by the request origin (is the request a local or remote request) and the setting of the errorMode property. The errorMode property is set to DetailedLocalOnly, which means that Custom Errors are generated for ...
errorModeOptional enum attribute. Specifies whether HTTP errors are enabled. TheerrorModeattribute can be one of the following values; the default isDetailedLocalOnly. Table 4 existingResponseOptional enum attribute. Specifies what happens to an existing response when the HTTP status code is an error...