Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: .NET
Expertise: Advanced
Jul 23, 2008

ASP.NET 2.0's Project Health Monitoring Feature

ASP.NET 2.0 provides much needed project health monitoring through its Health Monitoring feature. Simply add few tags and their values in Web.Config and your project will be automatically monitored.

This feature allows you to write to EventLog, SQL Server, and also lets you write your own provider. The easiest feature to implement is the "Email Sending" feature. This eliminates the need to log and mail code in the web site's framework. This feature is so intelligent that it sends a single email for the set interval, thus not flooding your mailbox. Add the "healthMonitoring" config section under the System.Web to Web.Config and set the key-values as shown in the code below:

<healthMonitoring enabled="true">
            <add name="EmailProvider" 
               subjectPrefix="Error: "
               bufferMode="Notification" />
            <add provider="EmailProvider" name="All App Events"  eventName="All Errors" />

Also add the System.Net Section for the SMTP Server Configuration
         <smtp from="mySMTP@projects.com">
            <network host="smtp.projects.com" />
Srinath MS
Thanks for your registration, follow us on our social networks to keep up-to-date