WebManagementEvent クラスとは? わかりやすく解説

WebManagementEvent クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

アプリケーションプロセス情報保持するイベント基本クラス定義します

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class WebManagementEvent
    Inherits WebBaseEvent
Dim instance As WebManagementEvent
public class WebManagementEvent : WebBaseEvent
public ref class WebManagementEvent : public
 WebBaseEvent
public class WebManagementEvent extends WebBaseEvent
public class WebManagementEvent extends
 WebBaseEvent
解説解説

運用および操作担当者は、ASP.NET Health Monitoring使用して配置されている Web アプリケーション管理できます。System.Web.Management 名前空間には、アプリケーションの状態データパッケージ化する状態イベント型、およびそのデータ処理するプロバイダ型が含まれます。また、状態イベント管理支援するサポート型も含まれます。

WebManagementEvent は、すべての ASP.NET 状態監視イベント型の基本クラスです。派生クラス使用できるプロセス情報取得には、WebProcessInformation クラス使用します

メモメモ

ほとんどの場合ASP.NET 状態監視型は実装のまま使用でき、healthMonitoring 構成セクションに値を指定して ASP.NET Health Monitoring system制御できます。状態監視型の派生として独自のイベントおよびプロバイダ作成することもできますWebManagementEvent クラス派生例については、このトピックの例を参照してください

継承時の注意 カスタム イベント情報表示用に書式設定する場合は、ToString メソッドではなく、FormatCustomEventDetails メソッドオーバーライドます。これにより、重要なシステム情報対す上書き不正な変更防げます。 カスタム イベント指定するイベント コードは WebExtendedBase より大きくする必要があります

使用例使用例

WebManagementEvent クラス派生としてカスタム イベント実装する方法次のコード例示します

Imports System
Imports System.Text
Imports System.Web
Imports System.Web.Management


' Implements a custom 
' WebManagementEvent class. 

Public Class SampleWebManagementEvent
   Inherits WebManagementEvent
   Private eventInfo As StringBuilder
   
   
   ' 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.
        eventInfo = New StringBuilder()
        eventInfo.Append(String.Format( _
        "Event created at: ", EventTime.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.
        eventInfo = New StringBuilder()
        eventInfo.Append(String.Format( _
        "Event created at: ", EventTime.ToString()))
    End Sub 'New
   
   
   ' Raises the SampleWebRequestEvent.
   Public Overrides Sub
 Raise()
      ' Perform custom processing. 
        eventInfo.Append(String.Format( _
        "Event raised at: ", EventTime.ToString()))
      ' Raise the event.
      MyBase.Raise()
   End Sub 'Raise
   
   
   ' Obtains the current process information.
   Public Function GetProcessInfo() As
 String
      Dim tempPi As New
 StringBuilder()
      Dim pi As WebProcessInformation = ProcessInformation
        tempPi.Append( _
        (pi.ProcessName + Environment.NewLine))
        tempPi.Append( _
        (pi.ProcessID.ToString() + Environment.NewLine))
        tempPi.Append( _
        (pi.AccountName + Environment.NewLine))
      Return tempPi.ToString()
   End Function 'GetProcessInfo
   
   
    Public Overrides Sub
 FormatCustomEventDetails( _
    ByVal formatter As WebEventFormatter)
        MyBase.FormatCustomEventDetails(formatter)

        ' Add custom data.
        formatter.AppendLine("")

        formatter.IndentationLevel += 1
        formatter.AppendLine( _
        "** SampleWebManagementEvent Start **")

        ' Add custom data.
        formatter.AppendLine(eventInfo.ToString())

        formatter.AppendLine( _
        "** SampleWebManagementEvent End **")
    End Sub 'FormatCustomEventDetails
End Class 'SampleWebManagementEvent
 

using System;
using System.Text;
using System.Web;
using System.Web.Management;

namespace Samples.AspNet.Management
{
    // Implements a custom 
    // WebManagementEvent class. 
    public class SampleWebManagementEvent :
 
        WebManagementEvent
    {
        private StringBuilder eventInfo;

        // Invoked in case of events 
        // identified only by their event code.
        public SampleWebManagementEvent(string
 msg, 
            object eventSource, int eventCode):
        base(msg, eventSource, eventCode)
        {
            // Perform custom initialization.
            eventInfo = new StringBuilder();
            eventInfo.Append(string.Format(
                "Event created at: ", 
                EventTime.ToString()));
        }


        // Invoked in case of events identified 
        // by their event code.and related 
        // event detailed code.
        public SampleWebManagementEvent(string
 msg, 
            object eventSource, int eventCode, 
            int eventDetailCode):
          base(msg, eventSource, 
            eventCode, eventDetailCode)
        {
            // Perform custom initialization.
            eventInfo = new StringBuilder();
            eventInfo.Append(string.Format(
                "Event created at: ", 
                EventTime.ToString()));
        }


        // Raises the SampleWebRequestEvent.
        public override void Raise()
        {
            // Perform custom processing. 
            eventInfo.Append(string.Format(
                "Event raised at: ", 
                EventTime.ToString()));
            // Raise the event.
            base.Raise();
        }


        // Obtains the current process information.
        public string GetProcessInfo()
        {
            StringBuilder tempPi = new StringBuilder();
            WebProcessInformation pi = ProcessInformation;
            tempPi.Append(
                pi.ProcessName + Environment.NewLine);
            tempPi.Append(
                pi.ProcessID.ToString() + Environment.NewLine);
            tempPi.Append(
                pi.AccountName + Environment.NewLine);
            return tempPi.ToString();
        }


        public override void FormatCustomEventDetails(
            WebEventFormatter formatter)
        {
            base.FormatCustomEventDetails(formatter);

            // Add custom data.
            formatter.AppendLine("");

            formatter.IndentationLevel += 1;
            formatter.AppendLine(
                "** SampleWebManagementEvent Start **");
          
            // Add custom data.
            formatter.AppendLine(eventInfo.ToString());

            formatter.AppendLine(
                      "** SampleWebManagementEvent End **");
          
        }
    }

}

次に示すのは、ASP.NETカスタム イベント使用できるようにする構成ファイル抜粋です。

<healthMonitoring enabled="true" 
  heartBeatInterval="0">

  <eventMappings>

    <add  name="SampleWebManagementEvent" type="SamplesAspNet.SampleWebManagementEvent,webmanagementevent,Version=1.0.1573.24438,
 Culture=neutral, PublicKeyToken=2f5f337ae5c9bdaa, processorArchitecture=MSIL"/>

  </eventMappings>

  <rules>
    <add 
      name="Custom WebManagementEvent"
      eventName="SampleWebManagementEvent"
      provider="EventLogProvider"
      profile="Critical"/>
  </rules>

</healthMonitoring>
継承階層継承階層
System.Object
   System.Web.Management.WebBaseEvent
    System.Web.Management.WebManagementEvent
       System.Web.Management.WebApplicationLifetimeEvent
       System.Web.Management.WebAuditEvent
       System.Web.Management.WebBaseErrorEvent
       System.Web.Management.WebHeartbeatEvent
       System.Web.Management.WebRequestEvent
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebManagementEvent メンバ
System.Web.Management 名前空間
WebAuditEvent クラス
その他の技術情報
healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「WebManagementEvent クラス」の関連用語

WebManagementEvent クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebManagementEvent クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS