使用Asp.net 2.0内建的健康状态监听器(health monitoring)

只需要在Web.config进行几个简单设置, 即可通过health monitoring将没有处理的错误信息发送到指定Email.

请关注: <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> 



详细请查看:  Mads KristensenHealth monitoring in ASP.NET 2.0
Health Monitoring in ASP.NET 2.0: Raising Custom Events
posted @ 2007-08-10 16:00  MK2  阅读(593)  评论(0编辑  收藏  举报