gpt4 book ai didi

asp.net - IIS7 不会显示 ASP.Net 错误消息或堆栈跟踪

转载 作者:行者123 更新时间:2023-12-02 13:07:08 25 4
gpt4 key购买 nike

我正在尝试调试 ASP.Net 3.5 应用程序中的错误。我们最近将应用程序从 IIS6 移至 7。在 IIS6 中,代码如下:

Throw new Exception("My message")

将显示一个页面,给出错误消息、附近的代码行和堆栈跟踪(使用“调试”编译模式并且没有自定义错误)。

在 IIS7 中,“详细”错误消息仅给出模块和错误代码:

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.

Detailed Error Information
Module global.asax
Notification BeginRequest
Handler StaticFile
Error Code 0x00000000
Requested URL [My URL]
Physical Path [My Path]
Logon Method Not yet determined
Logon User Not yet determined
Failed Request Tracing Log Directory [My Directory]

我什至设置了“失败请求跟踪”,它旨在提供堆栈跟踪,但仍然没有给我任何行号或错误消息,只有模块名称和 HTTP 状态。

No. 111.
Severity Warning
Event -MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName global.asax
Notification 1
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification BEGIN_REQUEST
ErrorCode The operation completed successfully. (0x0)

如何获取在 IIS6 中获取的信息?我已经知道错误位于 global.asax 中,我需要行号和特定的错误消息。

另外,我不确定这是否相关,但该网站是预编译的,并且 aspnet_compiler.exe 显然在编译时将 web.config“调试”开关设置为 false(即使使用“-d”选项)。我的 machine.config 没有“部署”标签。我只是将“debug”设置回 true 并在编译后回收,我认为这会将站点重新置于 Debug模式,对吗?

最佳答案

错误页面配置中有一个设置,可以告诉 IIS 为本地和远程请求显示的详细信息级别。您可能想验证其配置是否正确。要访问此设置,请启动 Internet 信息服务管理器并转至

Site Home\Error Pages\Edit Feature Settings

确保在生产中禁用此设置

关于asp.net - IIS7 不会显示 ASP.Net 错误消息或堆栈跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7014141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com