Partha
Partha

Reputation: 2192

Confusion on health monitoring in asp.net

Even i set enabled="false" in healthMonitoring element in machine-level web.config, asp.net captures the unhandled exception and does the entry on windows event log.

So, can you please tell me. Can we enable / disable the health monitoring in machine-level?

Your answers is appreciated.

Upvotes: 2

Views: 887

Answers (1)

Mohammed Swillam
Mohammed Swillam

Reputation: 9242

I think this is the normal behavior for any ASP.NET website when any unhandled exception occur.

if you are not handling it with your code, or at least providing a 404 page for non-exisitng resources, the event will bubble up to WIndows event log.

you can use any of the following methods in order to prevent Windows event log from listing your exceptions.

1- Create Custom 404 and 500 error pages, and set customErros mode to TRUE in your web.config.

<CustomErrors mode="On">

2- Catch your errors bu using Application_Errors handler in your Global.ASAX

3- Use [HandleError] attribute inside your controller code to let it use your custom error pages and swallow the error without exposing it to Windows event log.

Upvotes: 1

Related Questions