My ASP.NET app has a web.config healthMonitoring section set up to email me when errors occur. 开发者_如何学CPeriodically I get errors that I would like to ignore, such as Invalid Viewstate
or ScriptResource.axd
errors. Is there any way to configure web.config to NOT email me when the exception message matches a certain search string or regex?
I believe this is similar to Ignore HealthMonitoring event by EventDetailCode.
You can create a custom event provider by inheriting from the System.Web.Management.WebEventProvider base provider class. This way you could handle the errors you want to by emailing them and ignoring any others. Checkout "How to Write a Custom Web Event Provider for ASP.NET 2.0" and "Creating Custom Event Providers" for more info.
are you raising the events yourself, or are they raised in the background. I would look at the EventCode for the event and see if you can use that to distinguish between this event type and another? If you are raising the event yourself, like in a catch statement, you can easily separate it out. But if you are using the global blanket for catching all errors, there is no way. The only way is to use the event code in eventMapping and then add rules to catch that event and send it to a provider.
精彩评论