WebApplicationLifetimeEvent クラス
アセンブリ: System.Web (system.web.dll 内)


運用および操作の担当者は、ASP.NET Health Monitoring を使用して、配置されている Web アプリケーションを管理できます。System.Web.Management 名前空間には、アプリケーションの状態データをパッケージ化する状態イベント型、およびそのデータを処理するプロバイダ型が含まれます。また、状態イベント管理を支援するサポート型も含まれます。
アプリケーションの有効期間中のイベントには、アプリケーションの起動イベントやシャットダウン イベントなどがあります。アプリケーションが終了した場合、関連するイベント メッセージ フィールドを参照することでその原因がわかります。
WebApplicationLifetimeEvent が発生した場合、ASP.NET Health Monitoring system は Application Lifetime Events パフォーマンス カウンタを更新します。これらのイベントを記録するには、構成ファイルの healthMonitoring セクションの rules サブセクションに WebApplicationLifetimeEvent を追加します。次に例を示します。
<rules> <add name="Application Events" eventName="Application Lifetime Events" provider="EventLogProvider" profile="Default" minInterval="00:01:00" /> </rules>
Application Lifetime Events パフォーマンス カウンタには、ASP.NET の有効期間中のイベントすべての総数が格納されます。このパフォーマンス カウンタをシステム モニタ (PerfMon) に表示するには、[カウンタの追加] ウィンドウで [パフォーマンス オブジェクト] ドロップダウンリストの [ASP.NET] をクリックし、Application Lifetime Events パフォーマンス カウンタを選択して、[追加] ボタンをクリックします。詳細については、MSDN の「Using the System Monitor (PerfMon) with ASP.NET Applications」を参照してください。イベントを標準 EventLogWebEventProvider でログに記録することを許可してある場合、イベント ビューアでアプリケーション ログを選択するとイベントを表示できます。詳細については、TechNet の Windows Server 2003 に関するドキュメントの「Event Viewer」を参照してください。
![]() |
---|
ほとんどの場合、ASP.NET 状態監視型は実装のまま使用でき、healthMonitoring 構成セクションに値を指定して ASP.NET Health Monitoring system を制御できます。状態監視型の派生として独自のイベントおよびプロバイダを作成することもできます。WebApplicationLifetimeEvent クラスの派生の例については、このトピックの例を参照してください。 |

WebApplicationLifetimeEvent の派生としてカスタム イベントを作成する方法を次のコード例に示します。
Imports System Imports System.Text Imports System.Web Imports System.Web.Management ' Implements a custom WebManagementEvent class. Public Class SampleWebApplicationLifetimeEvent Inherits System.Web.Management.WebApplicationLifetimeEvent Private customCreatedMsg, customRaisedMsg As String ' Invoked in case of events identified only by ' their event code. Public Sub New(ByVal msg As String, _ ByVal eventSource As Object, _ ByVal eventCode As Integer) MyBase.New(msg, eventSource, eventCode) ' Perform custom initialization. customCreatedMsg = _ String.Format("Event created at: {0}", _ DateTime.Now.TimeOfDay.ToString()) End Sub 'New ' Invoked in case of events identified by their ' event code.and related event detailed code. Public Sub New(ByVal msg As String, _ ByVal eventSource As Object, _ ByVal eventCode As Integer, _ ByVal eventDetailCode As Integer) MyBase.New(msg, eventSource, _ eventCode, eventDetailCode) ' Perform custom initialization. customCreatedMsg = _ String.Format("Event created at: {0}", _ DateTime.Now.TimeOfDay.ToString()) End Sub 'New ' Raises the SampleWebRequestEvent. Public Overrides Sub Raise() ' Perform custom processing. customRaisedMsg = _ String.Format("Event raised at: {0}" + _ vbLf, DateTime.Now.TimeOfDay.ToString()) ' Raise the event. MyBase.Raise() End Sub 'Raise 'Formats Web request event information. Public Overrides Sub FormatCustomEventDetails( _ ByVal formatter As WebEventFormatter) MyBase.FormatCustomEventDetails(formatter) ' Add custom data. formatter.AppendLine("") formatter.IndentationLevel += 1 formatter.TabSize = 4 formatter.AppendLine( _ "*SampleWebApplicationLifetimeEvent Start *") formatter.AppendLine("Custom information goes here") formatter.AppendLine( _ "* SampleWebApplicationLifetimeEvent End *") ' Display custom event timing. formatter.AppendLine(customCreatedMsg) formatter.AppendLine(customRaisedMsg) formatter.IndentationLevel -= 1 End Sub 'FormatCustomEventDetails End Class 'SampleWebApplicationLifetimeEvent
using System; using System.Text; using System.Web; using System.Web.Management; namespace SamplesAspNet { // Implements a custom WebManagementEvent class. public class SampleWebApplicationLifetimeEvent : System.Web.Management.WebApplicationLifetimeEvent { private string customCreatedMsg, customRaisedMsg; // Invoked in case of events identified only by // their event code. public SampleWebApplicationLifetimeEvent(string msg, object eventSource, int eventCode): base(msg, eventSource, eventCode) { // Perform custom initialization. customCreatedMsg = string.Format("Event created at: {0}", DateTime.Now.TimeOfDay.ToString()); } // Invoked in case of events identified by their // event code.and related event detailed code. public SampleWebApplicationLifetimeEvent(string msg, object eventSource, int eventCode, int eventDetailCode): base(msg, eventSource, eventCode, eventDetailCode) { // Perform custom initialization. customCreatedMsg = string.Format("Event created at: {0}", DateTime.Now.TimeOfDay.ToString()); } // Raises the SampleWebRequestEvent. public override void Raise() { // Perform custom processing. customRaisedMsg = string.Format( "Event raised at: {0}\n", DateTime.Now.TimeOfDay.ToString()); // Raise the event. base.Raise(); } //Formats Web request event information. public override void FormatCustomEventDetails( WebEventFormatter formatter) { base.FormatCustomEventDetails(formatter); // Add custom data. formatter.AppendLine(""); formatter.IndentationLevel += 1; formatter.TabSize = 4; formatter.AppendLine( "*SampleWebApplicationLifetimeEvent Start *"); formatter.AppendLine("Custom information goes here"); formatter.AppendLine( "* SampleWebApplicationLifetimeEvent End *"); // Display custom event timing. formatter.AppendLine(customCreatedMsg); formatter.AppendLine(customRaisedMsg); formatter.IndentationLevel -= 1; } } }
次の構成ファイルの抜粋に、構成ファイルの healthMonitoring セクションを構成して、上記で定義される SampleWebApplicationLifetimeEvent コードを ASP.NET Health Monitoring system に追加する方法を示します。イベントをシステムに追加するには、eventMappings セクションに新しいエントリを追加してイベントを定義し、rules セクションに新しいエントリに追加して、そのイベントをプロバイダに対応付ける必要があります。
<healthMonitoring enabled="true" heartBeatInterval="0"> <eventMappings> <clear /> <!-- Configure the application lifetime event --> <!-- object to handle the Web application events. --> <add name="SampleApplicationLifetimeEvents" type="System.Web.Management.SampleWebApplicationLifetimeEvent, System.Web,Version=2.0.3600.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" /> </eventMappings> <rules> <clear/> // Configure the connection between the // application lifetime event object // and the provider that must process it. <add name="Custom Application Events" eventName="SampleApplicationLifetimeEvents" provider="EventLogProvider" profile="Default" minInterval="00:01:00" /> </rules> </healthMonitoring>

System.Web.Management.WebBaseEvent
System.Web.Management.WebManagementEvent
System.Web.Management.WebApplicationLifetimeEvent


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebApplicationLifetimeEvent コンストラクタ (String, Object, Int32)
アセンブリ: System.Web (system.web.dll 内)

Dim message As String Dim eventSource As Object Dim eventCode As Integer Dim instance As New WebApplicationLifetimeEvent(message, eventSource, eventCode)
protected internal WebApplicationLifetimeEvent ( string message, Object eventSource, int eventCode )
protected public: WebApplicationLifetimeEvent ( String^ message, Object^ eventSource, int eventCode )
protected internal function WebApplicationLifetimeEvent ( message : String, eventSource : Object, eventCode : int )

このコンストラクタは、ASP.NET Health Monitoring system によって内部的に使用されます。WebApplicationLifetimeEvent オブジェクトのインスタンス化には使用しませんが、このクラスを継承する独自のイベント型を実装する場合には呼び出すことができます。
![]() |
---|
WebApplicationLifetimeEvent コンストラクタは、コードで直接使用するためのものではありません。ASP.NET によって呼び出されます。WebApplicationLifetimeEvent コンストラクタは、WebApplicationLifetimeEvent クラスの派生の場合に呼び出すことができます。 |

WebApplicationLifetimeEvent を ASP.NET カスタム状態イベントで使用する方法を次のコード例に示します。このコード例の主な目的は、使用するための正しい構文を示すことです。
' Invoked in case of events identified only by ' their event code. Public Sub New(ByVal msg As String, _ ByVal eventSource As Object, _ ByVal eventCode As Integer) MyBase.New(msg, eventSource, eventCode) ' Perform custom initialization. customCreatedMsg = _ String.Format("Event created at: {0}", _ DateTime.Now.TimeOfDay.ToString()) End Sub 'New
// Invoked in case of events identified only by // their event code. public SampleWebApplicationLifetimeEvent(string msg, object eventSource, int eventCode): base(msg, eventSource, eventCode) { // Perform custom initialization. customCreatedMsg = string.Format("Event created at: {0}", DateTime.Now.TimeOfDay.ToString()); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebApplicationLifetimeEvent コンストラクタ

名前 | 説明 |
---|---|
WebApplicationLifetimeEvent (String, Object, Int32) | 指定したパラメータを使用して WebApplicationLifetimeEvent クラスを初期化します。 |
WebApplicationLifetimeEvent (String, Object, Int32, Int32) | 指定したパラメータを使用して WebApplicationLifetimeEvent クラスを初期化します。 |

WebApplicationLifetimeEvent コンストラクタ (String, Object, Int32, Int32)
アセンブリ: System.Web (system.web.dll 内)

Protected Friend Sub New ( _ message As String, _ eventSource As Object, _ eventCode As Integer, _ eventDetailCode As Integer _ )
Dim message As String Dim eventSource As Object Dim eventCode As Integer Dim eventDetailCode As Integer Dim instance As New WebApplicationLifetimeEvent(message, eventSource, eventCode, eventDetailCode)
protected internal WebApplicationLifetimeEvent ( string message, Object eventSource, int eventCode, int eventDetailCode )
protected public: WebApplicationLifetimeEvent ( String^ message, Object^ eventSource, int eventCode, int eventDetailCode )
protected WebApplicationLifetimeEvent ( String message, Object eventSource, int eventCode, int eventDetailCode )
protected internal function WebApplicationLifetimeEvent ( message : String, eventSource : Object, eventCode : int, eventDetailCode : int )

このコンストラクタは、ASP.NET Health Monitoring system によって内部的に使用されます。WebApplicationLifetimeEvent オブジェクトのインスタンス化には使用しませんが、このクラスを継承する独自のイベント型を実装する場合には呼び出すことができます。
![]() |
---|
WebApplicationLifetimeEvent コンストラクタは、コードで直接使用するためのものではありません。ASP.NET によって呼び出されます。WebApplicationLifetimeEvent コンストラクタは、WebApplicationLifetimeEvent クラスの派生の場合に呼び出すことができます。 |

WebApplicationLifetimeEvent を ASP.NET カスタム状態イベントで使用する方法を次のコード例に示します。このコード例の主な目的は、使用するための正しい構文を示すことです。
' Invoked in case of events identified by their ' event code.and related event detailed code. Public Sub New(ByVal msg As String, _ ByVal eventSource As Object, _ ByVal eventCode As Integer, _ ByVal eventDetailCode As Integer) MyBase.New(msg, eventSource, _ eventCode, eventDetailCode) ' Perform custom initialization. customCreatedMsg = _ String.Format("Event created at: {0}", _ DateTime.Now.TimeOfDay.ToString()) End Sub 'New
// Invoked in case of events identified by their // event code.and related event detailed code. public SampleWebApplicationLifetimeEvent(string msg, object eventSource, int eventCode, int eventDetailCode): base(msg, eventSource, eventCode, eventDetailCode) { // Perform custom initialization. customCreatedMsg = string.Format("Event created at: {0}", DateTime.Now.TimeOfDay.ToString()); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebApplicationLifetimeEvent プロパティ

名前 | 説明 | |
---|---|---|
![]() | ApplicationInformation | 監視中の現在のアプリケーションに関する情報を格納している WebApplicationInformation オブジェクトを取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventCode | イベントに関連付けられているコード値を取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventDetailCode | イベント詳細コードを取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventID | イベントに関連付けられている識別子を取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventOccurrence | イベントが発生した回数を表すカウンタを取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventSequence | アプリケーションによるイベントの発生回数を取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventSource | イベントを発生させるオブジェクトを取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventTime | イベントが発生した時刻を取得します。 ( WebBaseEvent から継承されます。) |
![]() | EventTimeUtc | イベントが発生した時刻を取得します。 ( WebBaseEvent から継承されます。) |
![]() | Message | イベントを説明するメッセージを取得します。 ( WebBaseEvent から継承されます。) |
![]() | ProcessInformation | ASP.NET アプリケーション ホスト プロセスに関する情報を取得します。 ( WebManagementEvent から継承されます。) |

WebApplicationLifetimeEvent メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | FormatCustomEventDetails | イベント情報の標準的な形式を提供します。 ( WebBaseEvent から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | Raise | オーバーロードされます。 WebBaseEvent イベントを発生させ、構成されているプロバイダにこのイベントが発生したことを通知します。 ( WebBaseEvent から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | オーバーロードされます。 イベント情報を表示用に書式設定します。 ( WebBaseEvent から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | IncrementPerfCounters | オーバーライドされます。 パフォーマンス カウンタをインクリメントするために、内部的に使用されます。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

WebApplicationLifetimeEvent メンバ
アプリケーションの有効期間中に発生した重要なイベントを表します。
WebApplicationLifetimeEvent データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | ApplicationInformation | 監視中の現在のアプリケーションに関する情報を格納している WebApplicationInformation オブジェクトを取得します。(WebBaseEvent から継承されます。) |
![]() | EventCode | イベントに関連付けられているコード値を取得します。(WebBaseEvent から継承されます。) |
![]() | EventDetailCode | イベント詳細コードを取得します。(WebBaseEvent から継承されます。) |
![]() | EventID | イベントに関連付けられている識別子を取得します。(WebBaseEvent から継承されます。) |
![]() | EventOccurrence | イベントが発生した回数を表すカウンタを取得します。(WebBaseEvent から継承されます。) |
![]() | EventSequence | アプリケーションによるイベントの発生回数を取得します。(WebBaseEvent から継承されます。) |
![]() | EventSource | イベントを発生させるオブジェクトを取得します。(WebBaseEvent から継承されます。) |
![]() | EventTime | イベントが発生した時刻を取得します。(WebBaseEvent から継承されます。) |
![]() | EventTimeUtc | イベントが発生した時刻を取得します。(WebBaseEvent から継承されます。) |
![]() | Message | イベントを説明するメッセージを取得します。(WebBaseEvent から継承されます。) |
![]() | ProcessInformation | ASP.NET アプリケーション ホスト プロセスに関する情報を取得します。(WebManagementEvent から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | FormatCustomEventDetails | イベント情報の標準的な形式を提供します。 (WebBaseEvent から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | Raise | オーバーロードされます。 WebBaseEvent イベントを発生させ、構成されているプロバイダにこのイベントが発生したことを通知します。 (WebBaseEvent から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | オーバーロードされます。 イベント情報を表示用に書式設定します。 (WebBaseEvent から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | IncrementPerfCounters | オーバーライドされます。 パフォーマンス カウンタをインクリメントするために、内部的に使用されます。 |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- WebApplicationLifetimeEventのページへのリンク