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.
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.
2- Catch your errors bu using
Application_Errorshandler in your Global.ASAX3- 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.