ASP.NET 应用程序未记录到 Windows 事件日志

发布于 2024-08-25 10:55:01 字数 148 浏览 7 评论 0原文

我有两个 ASP.NET MVC Web 应用程序。其中之一将未处理的异常记录到 Windows 事件日志中。另一个则不然。

IIS 或 web.config 中是否有启用事件日志记录的设置?

对于这个广泛的问题,我深表歉意,我真的在寻找调查途径。

I have two ASP.NET MVC web applications. One of them logs unhandled exceptions to the windows event log. The other doesn't.

Is there a setting in IIS or the web.config to enable event log logging?

Apologies for the broad question, I'm really looking for avenues for investigation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一张白纸 2024-09-01 10:55:01

这通常是由于运行 Web 应用程序的帐户没有写入事件日志的正确权限。

在 IIS 7 中,检查运行应用程序池的标识。

This is normally due to the account running the web application not having the right permissions to write to the event log.

In IIS 7, check the identity the application pool is running under.

沒落の蓅哖 2024-09-01 10:55:01

如果运行 web 应用程序的用户(IIS 用户)不是管理员,请确保事件源已在操作系统中注册。

If the user running the webapp (the IIS user) isn't an admin, make sure that the event source is registered with the OS.

肥爪爪 2024-09-01 10:55:01

打开 CustomErrors 开始将内容添加到错误日志中。

最终的解决方案是添加

<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
...

web.config 的部分。这在 IIS7 中启用了 Elmah。

理解松散 - 异常被 elmah 拦截,由于上述原因,elmah 配置错误,导致错误被吞没。打开自定义错误,似乎绕过了 elmah 并使错误能够推送到事件日志。

Turning CustomErrors on started stuff being added to error log.

Final solution was to add

<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>

to the

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
...

Section of the web.config. This enabled Elmah in IIS7.

Loose understanding - exceptions were being intercepted by elmah, which was mal-configured for the above reason, causing swallowing of errors. Turning custom errors on, seemed to bypass elmah and enable errors to push through to event log.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文