請關注: <healthMonitoring />和<system.Net />兩個節點的設定.
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="false" />
<trace enabled="true" localOnly="false" />
<healthMonitoring enabled="true">
<providers>
<add name="EmailProvider"
type="System.Web.Management.SimpleMailWebEventProvider"
from="you@domain.com"
to="you@domain.com"
subjectPrefix="Error: "
buffer="true"
bufferMode="Notification" />
</providers>
<rules>
<add provider="EmailProvider" name="All App Events" eventName="All Errors" />
</rules>
</healthMonitoring>
</system.web>
<system.net>
<mailSettings>
<smtp from="you@domain.com">
<network host="smtp.domain.com" />
</smtp>
</mailSettings>
</system.net>
</configuration>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="false" />
<trace enabled="true" localOnly="false" />
<healthMonitoring enabled="true">
<providers>
<add name="EmailProvider"
type="System.Web.Management.SimpleMailWebEventProvider"
from="you@domain.com"
to="you@domain.com"
subjectPrefix="Error: "
buffer="true"
bufferMode="Notification" />
</providers>
<rules>
<add provider="EmailProvider" name="All App Events" eventName="All Errors" />
</rules>
</healthMonitoring>
</system.web>
<system.net>
<mailSettings>
<smtp from="you@domain.com">
<network host="smtp.domain.com" />
</smtp>
</mailSettings>
</system.net>
</configuration>
詳細請檢視: Mads Kristensen的Health monitoring in ASP.NET 2.0
Health Monitoring in ASP.NET 2.0: Raising Custom Events