Share via


healthMonitoring 項目 (ASP.NET 設定結構描述)

更新:2007 年 11 月

設定健康監視的應用程式。

這個項目是 .NET Framework 2.0 版中新增的項目。

<configuration> 項目
  system.web 項目 (ASP.NET 設定結構描述)
    healthMonitoring 項目 (ASP.NET 設定結構描述)

 <healthMonitoring     Enabled="true|false"    heartbeatInterval="time interval">    <bufferModes>...</bufferModes>    <providers>...</providers>    <eventMappings>...</eventMappings>    <profiles>...</profiles>    <rules>...</rules> </healthMonitoring> 

屬性和項目

下列小節描述這個區段的屬性、子項目和父項目。

屬性

屬性

描述

enabled

必要的 Boolean 屬性。

指定是否啟用健康監視。如果為 true,就會啟用健康監視。

heartbeatInterval

必要的 TimeSpan 屬性。

指定引發 WebHeartbeatEvent 事件的間隔頻率 (以秒為單位)。

預設值為 "00:00:00",表示不會引發任何 WebHeartbeatEvent 事件。

子項目

項目

描述

bufferModes

選擇性項目。

定義提供者的緩衝功能。

eventMappings

選擇性項目。

將易記事件名稱對應至相關事件型別。

profiles

選擇性項目。

定義當設定事件時可以使用的參數集集合。

providers

選擇性項目。

定義處理事件的健康監視提供者。

rules

選擇性項目。

將事件對應至提供者。

父項目

項目

描述

configuration

指定 Common Language Runtime 和 .NET Framework 應用程式所使用之每個組態檔中需要的根項目 (Root Element)。

system.web

指定 ASP.NET 組態區段的根項目。

備註

這個組態區段會在電腦或應用程式層級套用。

預設的組態

下列預設的 healthMonitoring 項目是在 .NET Framework 2.0 版中的根 Web.config 檔中設定。

<healthMonitoring>
   <bufferModes>
       <add name="Critical Notification" maxBufferSize="100" maxFlushSize="20" 
            urgentFlushThreshold="1" regularFlushInterval="Infinite" urgentFlushInterval="00:01:00" 
            maxBufferThreads="1" />
       <add name="Notification" maxBufferSize="300" maxFlushSize="20" urgentFlushThreshold="1" 
            regularFlushInterval="Infinite" urgentFlushInterval="00:01:00" 
            maxBufferThreads="1" />
       <add name="Analysis" maxBufferSize="1000" maxFlushSize="100" urgentFlushThreshold="100" 
            regularFlushInterval="00:05:00" urgentFlushInterval="00:01:00" 
            maxBufferThreads="1" />
       <add name="Logging" maxBufferSize="1000" maxFlushSize="200" urgentFlushThreshold="800" 
            regularFlushInterval="00:30:00" urgentFlushInterval="00:05:00" 
            maxBufferThreads="1" />
   </bufferModes>

   <providers>
       <add name="EventLogProvider"
            type="System.Web.Management.EventLogWebEventProvider,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
       <add ConnectionStringName="LocalSqlServer" maxEventDetailsLength="1073741823" 
            buffer="false" bufferMode="Notification" name="SqlWebEventProvider"
            type="System.Web.Management.SqlWebEventProvider,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
       <add name="WmiWebEventProvider"
            type="System.Web.Management.WmiWebEventProvider,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
   </providers>

   <profiles>
       <add name="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" 
            custom="" />
       <add name="Critical" minInstances="1" maxLimit="Infinite" minInterval="00:00:00" 
            custom="" />
   </profiles>

   <rules>
       <add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" 
            profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" 
            custom="" />
       <add name="Failure Audits Default" eventName="Failure Audits"
            provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" 
            minInterval="00:01:00" custom="" />
   </rules>

   <eventMappings>
       <add name="All Events" 
            type="System.Web.Management.WebBaseEvent, 
System.Web,Version=2.0.0.0,Culture=neutral,
            PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="Heartbeats" 
            type="System.Web.Management.WebHeartbeatEvent, 
System.Web,Version=2.0.0.0,Culture=neutral,
            PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="Application Lifetime Events" 
            type="System.Web.Management.WebApplicationLifetimeEvent, 
System.Web,Version=2.0.0.0,Culture=neutral, 
            PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="Request Processing Events" 
            type="System.Web.Management.WebRequestEvent, 
System.Web,Version=2.0.0.0,Culture=neutral, 
            PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="All Errors"
             type="System.Web.Management.WebBaseErrorEvent, 
System.Web,Version=2.0.0.0,Culture=neutral, 
             PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="Infrastructure Errors" 
             type="System.Web.Management.WebErrorEvent, 
System.Web,Version=2.0.0.0,Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="Request Processing Errors" 
             type="System.Web.Management.WebRequestErrorEvent, 
System.Web,Version=2.0.0.0,Culture=neutral, 
             PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="All Audits"               type="System.Web.Management.WebAuditEvent, 
System.Web,Version=2.0.0.0,Culture=neutral, 
               PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
       <add name="Failure Audits" 
             type="System.Web.Management.WebFailureAuditEvent, System.Web,Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
endEventCode="2147483647" />
       <add name="Success Audits" 
             type="System.Web.Management.WebSuccessAuditEvent, 
System.Web,Version=2.0.0.0,Culture=neutral, 
             PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647" />
    </eventMappings>
</healthMonitoring>

範例

下列程式碼範例示範如何設定應用程式以監視健康狀態。

<healthMonitoring Enabled="true" heartbeatInterval="00:00:00">
  <!-- Configure the providers -->
  <providers>
    <add name="SampleEventProvider" type="Samples.AspNet.SampleEventProvider,SampleEventProvider,
Version=0.0.0.0,Culture=neutral,PublicKeyToken=92029af6cf75bd7c,ProcessorArchitecture=Neutral"/>
  </providers>

  <!--  Configure the events -->
  <eventMappings>
    <add  name="SampleWebRequests" type="Samples.AspNet.SampleWebRequestEvent,SampleWebRequestEvent,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=f0c63b9a560d5e5a"/>
  </eventMappings>

  <!-- Define the rules -->
  <rules>
    <add name="Sample Web Requests"
      eventName="SampleWebRequests"
      provider="SampleEventProvider"
      profile="Default"
      minInterval="00:01:00" />

    <add name="Standard Web Requests"
      eventName="All Events"
      provider="SampleEventProvider"
      profile="Default"
      minInterval="00:01:00" />
  </rules>

</healthMonitoring>

項目資訊

組態區段處理常式

System.Web.Configuration.HealthMonitoringSection

組態成員

SystemWebSectionGroup.HealthMonitoring

可設定的位置

Machine.config

根層次的 Web.config

應用程式層級的 Web.config

需求

Microsoft Internet Information Services (IIS) 5.0、5.1 或 6.0 版

.NET Framework 2.0 版

Microsoft Visual Studio 2005

請參閱

工作

HOW TO:鎖定 ASP.NET 組態設定

概念

ASP.NET 組態概觀

ASP.NET Web 伺服器控制項和瀏覽器能力

保護 ASP.NET 組態

ASP.NET 組態案例

參考

system.web 項目 (ASP.NET 設定結構描述)

configuration 項目 (一般設定結構描述)

healthMonitoring 的 bufferModes 項目 (ASP.NET 設定結構描述)

healthMonitoring 的 eventMappings 項目 (ASP.NET 設定結構描述)

healthMonitoring 的 profiles 項目 (ASP.NET 設定結構描述)

healthMonitoring 的 providers 項目 (ASP.NET 設定結構描述)

healthMonitoring 的 profiles 項目 (ASP.NET 設定結構描述)

healthMonitoring 的 rules 項目 (ASP.NET 設定結構描述)

System.Configuration

System.Web.Configuration

System.Web.Management

其他資源

ASP.NET 健康監視

ASP.NET 組態檔

ASP.NET 組態設定

一般組態設定 (ASP.NET)

ASP.NET 組態 API