다음을 통해 공유


WebManagementEvent 클래스

정의

애플리케이션 및 프로세스 정보를 전달하는 이벤트에 대한 기본 클래스를 정의합니다.

public ref class WebManagementEvent : System::Web::Management::WebBaseEvent
public class WebManagementEvent : System.Web.Management.WebBaseEvent
type WebManagementEvent = class
    inherit WebBaseEvent
Public Class WebManagementEvent
Inherits WebBaseEvent
상속
WebManagementEvent
파생

예제

다음 예제에서 파생 시켜 사용자 지정 이벤트를 구현 하는 방법을 보여 줍니다는 WebManagementEvent 클래스입니다.


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 **");
        }
    }
}
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
   
   
   ' 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
   
   
   ' 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
   
   
   ' 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
End Class

다음은 사용자 지정 이벤트를 사용 하는 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>  

설명

ASP.NET 상태 모니터링 프로덕션와 운영 스태프를 배포 된 웹 애플리케이션을 관리할 수 있습니다. System.Web.Management 네임 스페이스 애플리케이션 상태 데이터 및이 데이터 처리를 담당 하는 공급자 형식이 패키징 담당 상태 이벤트 형식을 포함 합니다. 또한 상태 이벤트를 관리 하는 동안 유용한 지 원하는 형식을 포함 합니다.

WebManagementEvent 모든 ASP.NET 상태 모니터링 이벤트 형식에 대 한 기본 클래스입니다. 사용 하 여는 WebProcessInformation 클래스 파생된 된 클래스에 사용할 수 있는 프로세스 정보를 얻을 수 있습니다.

참고

대부분의 경우에 구현 된 대로 ASP.NET 상태 모니터링 유형을 사용할 수 없게 됩니다 및에서 값을 지정 하 여 상태 모니터링 시스템을 제어 하는 healthMonitoring 구성 섹션입니다. 사용자 고유의 사용자 지정 이벤트 및 공급자 상태 모니터링 형식에서 파생할 수 있습니다. 파생의 예는 WebManagementEvent 클래스,이 항목에 제공 된 예제를 참조 하세요.

상속자 참고

표시를 위해 사용자 지정 이벤트 정보를 포맷할 때 재정의 된 FormatCustomEventDetails(WebEventFormatter) 메서드 대신 ToString 메서드. 이 중요 한 시스템 정보를 덮어쓰거나 훼손 하지 것입니다.

이벤트 코드를 지정 하는 사용자 지정 이벤트 보다 커야 WebExtendedBase합니다.

생성자

WebManagementEvent(String, Object, Int32)

제공된 매개 변수를 사용하여 WebManagementEvent 클래스의 새 인스턴스를 초기화합니다.

WebManagementEvent(String, Object, Int32, Int32)

제공된 매개 변수를 사용하여 WebManagementEvent 클래스의 새 인스턴스를 초기화합니다.

속성

EventCode

이벤트와 관련된 코드 값을 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventDetailCode

이벤트 상세 코드를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventID

이벤트와 연결된 식별자를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventOccurrence

이벤트가 발생한 횟수를 나타내는 카운터를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventSequence

애플리케이션에서 이벤트가 발생한 횟수를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventSource

이벤트를 발생시킨 개체를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventTime

이벤트가 발생한 시간을 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventTimeUtc

이벤트가 발생한 시간을 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
Message

이벤트를 설명하는 메시지를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
ProcessInformation

ASP.NET 애플리케이션-호스팅 프로세스에 대한 정보를 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
FormatCustomEventDetails(WebEventFormatter)

이벤트 정보에 대한 표준 형식을 제공합니다.

(다음에서 상속됨 WebBaseEvent)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IncrementPerfCounters()

성능 카운터를 증가시키기 위해 내부적으로 사용됩니다.

(다음에서 상속됨 WebBaseEvent)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Raise()

이벤트가 발생한 사실을 구성된 공급자에게 알려 이벤트를 발생시킵니다.

(다음에서 상속됨 WebBaseEvent)
ToString()

표시하기 위해 이벤트 정보의 서식을 지정합니다.

(다음에서 상속됨 WebBaseEvent)
ToString(Boolean, Boolean)

표시하기 위해 이벤트 정보의 서식을 지정합니다.

(다음에서 상속됨 WebBaseEvent)

적용 대상

추가 정보