TemplatedMailWebEventProvider 類別

定義

實作事件提供者,以便使用範本來定義和格式化作為事件通知所傳送的電子郵件。

public ref class TemplatedMailWebEventProvider sealed : System::Web::Management::MailWebEventProvider
public sealed class TemplatedMailWebEventProvider : System.Web.Management.MailWebEventProvider
type TemplatedMailWebEventProvider = class
    inherit MailWebEventProvider
Public NotInheritable Class TemplatedMailWebEventProvider
Inherits MailWebEventProvider
繼承

範例

下列範例是組態檔摘錄,示範如何在 區段中指定 類型的 SimpleMailWebEventProvider<healthMonitoring> 提供者。 <add> 區段中的 <rules> 元素會指定提供者將處理要求處理錯誤和基礎結構錯誤。

<system.web>  
  <healthMonitoring  
    enabled="true"  
    heartBeatInterval="0">  
    <bufferModes>  
      <add name="Critical Notification"  
        maxBufferSize="100"  
        maxFlushSize="20"  
        urgentFlushThreshold="1"  
        regularFlushInterval="Infinite"  
        urgentFlushInterval="00:01:00"  
        maxBufferThreads="1"  
      />  
    </bufferModes>  
    <providers>  
      <add name="CriticalMailEventProvider"  
        type="System.Web.Management.TemplatedMailWebEventProvider,   
        System.Web, Version=%ASSEMBLY_VERSION%, Culture=neutral,   
        PublicKeyToken=%MICROSOFT_PUBLICKEY%"  
        template="../mailtemplates/critical.aspx"  
        from="sender address"  
        to="someone@example.com"   
        cc="someone@example.com"  
        bcc="someone@example.com"  
        priority="High"  
        bodyHeader="Warning!"  
        bodyFooter="Please investigate ASAP."  
        subjectPrefix="Action required."  
        buffer="true"  
        bufferMode="Critical Notification"  
        maxEventLength="4096"  
        maxSize="4096"  
        maxMessagesPerNotification="1"  
      />  
    </providers>  
    <eventMappings>  
      <add name="Request Processing Events"  
        type="System.Web.Management.WebRequestEvent, System.Web",   
        Version=%ASSEMBLY_VERSION%, Culture=neutral,   
        PublicKeyToken=%MICROSOFT_PUBLICKEY%"   
      />  
      <add name="Infrastructure Errors"  
        type="System.Web.Management.WebErrorEvent, System.Web,   
        Version=%ASSEMBLY_VERSION%, Culture=neutral,   
        PublicKeyToken=%MICROSOFT_PUBLICKEY%"   
      />  
    </eventMappings>  
    <profiles>  
      <add name="Default"  
        minInstances="1"  
        maxLimit="Infinite"  
        minInterval="00:10:00"  
      />  
      <add name="Critical"  
        minInstances="1"  
        maxLimit="1024"  
        minInterval="00:00:00"  
      />  
    </profiles>  
    <rules>  
      <add name="Request Processing Errors"  
        eventName="Request Processing Errors"  
        provider="CriticalMailEventProvider"  
        profile="Default"  
      />  
      <add name="Infrastructure Notifications"  
        eventName="Infrastructure Errors"  
        provider="CriticalMailEventProvider"  
        profile="Critical"  
      />  
    </rules>  
  </healthMonitoring>   
</system.web>  

備註

ASP.NET 健康情況監視可讓生產與作業人員管理已部署的 Web 應用程式。 System.Web.Management命名空間包含負責封裝應用程式健康狀態資料的健全狀況事件種類,以及負責處理此資料的提供者類型。 它也包含支援類型,可協助管理健康情況事件。

這個類別並不適合從程式碼使用。 它會由 ASP.NET 健康情況監視系統建立、設定及使用,以透過電子郵件傳送事件通知。 您可以在組態檔中定義電子郵件 Web 事件提供者,如本主題的範例一節所示。 此外,您可以透過存取 HealthMonitoringSection.Providers 屬性,以程式設計方式設定提供者區段。

這個類別產生的電子郵件是使用範本來定義和格式化。 此範本是由標準 .aspx 檔案中定義的標記程式碼所組成,可輸出訊息本文的文字。 範本所使用的事件資訊是由 MailEventNotificationInfo 可從這個類別的靜態 CurrentNotification 屬性取得的 物件所提供。

此提供者具有一組完整的組態屬性,可讓您用來自訂其運作方式。

屬性

BufferMode

取得值,表示提供者使用的緩衝模式。

(繼承來源 BufferedWebEventProvider)
CurrentNotification

取得事件通知物件,該物件會提供電子郵件範本使用的事件資訊。

Description

取得簡短、易讀的描述,適合顯示在管理工具或其他使用者介面 (UI) 中。

(繼承來源 ProviderBase)
Name

取得用來在設定期間代表提供者的易記名稱。

(繼承來源 ProviderBase)
UseBuffering

取得值,指出提供者是否處於緩衝模式。

(繼承來源 BufferedWebEventProvider)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
Flush()

將事件從提供者的緩衝區移至事件記錄檔。

(繼承來源 BufferedWebEventProvider)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
Initialize(String, NameValueCollection)

設定這個物件的初始值。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ProcessEvent(WebBaseEvent)

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

處理傳遞給提供者的事件。

(繼承來源 MailWebEventProvider)
ProcessEventFlush(WebEventBufferFlushInfo)

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

從提供者的緩衝區中移除所有事件。

(繼承來源 MailWebEventProvider)
Shutdown()

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

執行與關閉提供者關聯的工作。

(繼承來源 MailWebEventProvider)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱