WebEventBufferFlushInfo 類別

定義

包含定義清除緩衝區特性的參數。

public ref class WebEventBufferFlushInfo sealed
public sealed class WebEventBufferFlushInfo
type WebEventBufferFlushInfo = class
Public NotInheritable Class WebEventBufferFlushInfo
繼承
WebEventBufferFlushInfo

範例

下列程式碼範例示範如何使用 WebEventBufferFlushInfo 類別。 此程式碼範例是針對 類別提供的較大範例的 BufferedWebEventProvider 一部分。


// Processes the messages that have been buffered.
// It is called by the ASP.NET when the flushing of 
// the buffer is required.
public override void ProcessEventFlush(
    WebEventBufferFlushInfo flushInfo)
{

    // Customize event information to be sent to 
    // the Windows Event Viewer Application Log.
    customInfo.AppendLine(
        "SampleEventLogWebEventProvider buffer flush.");

    customInfo.AppendLine(
        string.Format("NotificationType: {0}",
        GetNotificationType(flushInfo)));

    customInfo.AppendLine(
        string.Format("EventsInBuffer: {0}",
        GetEventsInBuffer(flushInfo)));

    customInfo.AppendLine(
        string.Format(
        "EventsDiscardedSinceLastNotification: {0}",
        GetEventsDiscardedSinceLastNotification(flushInfo)));

    // Read each buffered event and send it to the
    // Application Log.
    foreach (WebBaseEvent eventRaised in flushInfo.Events)
        customInfo.AppendLine(eventRaised.ToString());

    // Store the information in the specified file.
    StoreToFile(customInfo, logFilePath, FileMode.Append);
}
    ' Processes the messages that have been buffered.
    ' It is called by the ASP.NET when the flushing of 
    ' the buffer is required according to the parameters 
    ' defined in the <bufferModes> element of the 
    ' <healthMonitoring> configuration section.
    Public Overrides Sub ProcessEventFlush(ByVal flushInfo _
    As WebEventBufferFlushInfo)

        ' Customize event information to be sent to 
        ' the Windows Event Viewer Application Log.
        customInfo.AppendLine( _
        "SampleEventLogWebEventProvider buffer flush.")

        customInfo.AppendLine(String.Format( _
        "NotificationType: {0}", _
        GetNotificationType(flushInfo)))

        customInfo.AppendLine(String.Format( _
        "EventsInBuffer: {0}", _
        GetEventsInBuffer(flushInfo)))

        customInfo.AppendLine(String.Format( _
        "EventsDiscardedSinceLastNotification: {0}", _
GetEventsDiscardedSinceLastNotification( _
flushInfo)))

        ' Read each buffered event and send it to the
        ' Application Log.
        Dim eventRaised As WebBaseEvent
        For Each eventRaised In flushInfo.Events
            customInfo.AppendLine(eventRaised.ToString())
        Next eventRaised
        ' Store the information in the specified file.
        StoreToFile(customInfo, logFilePath, _
        FileMode.Append)
    End Sub

備註

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

類別 WebEventBufferFlushInfo 會定義識別緩衝區目前狀態的值。 類別的實例會當做參數傳遞至 ProcessEventFlush 處理已緩衝訊息的方法。 當需要清除緩衝區時,ASP.NET 健康情況監視會呼叫此方法。 這是由組態區段中的 bufferModes 元素 healthMonitoring 所定義的參數所決定。

注意

根據設計,緩衝機制可能會卸載某些事件,以跟上傳入事件的步調。 使用者可藉由正確修改 bufferModes 組態區段中的 healthMonitoring 元素來調整此機制。

屬性

Events

取得目前訊息的事件集合。

EventsDiscardedSinceLastNotification

取得上次告知以來卸除的事件數目。

EventsInBuffer

取得緩衝區中的事件數目。

LastNotificationUtc

取得上次告知的日期和時間。

NotificationSequence

取得目前告知的訊息序列。

NotificationType

取得目前告知的類型。

方法

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

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

(繼承來源 Object)

適用於

另請參閱