I am looking for a step-by-step guide on creating and using a custom provider for ASP.Net Healthmonitoring.
So far, I have only worked with an email provider that generates error emails. Basically, I want to do the same, but with more flexibility:
I want to use the HealthMonitoring functions (I do not want to use the Application_OnError event in global.asax) so that I have access to the event that is generated as "OnNewHealthMonitoringEntry" with all the information provided in the email to run custom code.
Edit:
Based on the source code given here http://www.asp.net/general/videos/how-do-i-create-a-custom-provider-for-logging-health-monitoring-events I was able to create my own custom provider and implement it. Now I want to add some new attributes to configure my custom provider. This is what web.config looks like:
<healthMonitoring>
<bufferModes>
<add name="Log Notification" maxBufferSize="1" maxFlushSize="1" urgentFlushThreshold="1" regularFlushInterval="Infinite" urgentFlushInterval="00:00:10"/>
</bufferModes>
<providers>
<add name="FileEventProvider" buffer="true" bufferMode="Log Notification" type="healthmonitoringtest.FileHealthMonitorEventProvider"/>
</providers>
<profiles>
<add name="Custom" minInstances="1" maxLimit="Infinite" minInterval="00:00:00"/>
</profiles>
<rules>
<add name="File Event Provider" eventName="All Errors" provider="FileEventProvider" profile="Custom"/>
</rules>
</healthMonitoring>
If I try to add an attribute to the provider, for example
<providers>
<add name="FileEventProvider" buffer="true" bufferMode="Log Notification" foo="bar" type="healthmonitoringtest.FileHealthMonitorEventProvider"/>
</providers>
I get an error message:
An exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Web.dll, but was not handled in the user code. The information: Unexpected attribute foo in configuration FileEventProvider.
, , healthMonitoring? , appSettings node, - ( healthMonitoring node). ?
Edit2:
: http://www.tomot.de/en-us/article/6/asp.net/how-to-create-a-custom-healthmonitoring-provider-that-sends-e-mails