使用Asp.net 2.0內建的健康狀態監聽器(health monitoring)

weixin_34119545發表於2007-08-10
只需要在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

相關文章