다음을 통해 공유


WebApplicationLifetimeEvent 클래스

정의

애플리케이션의 수명에서 중요한 이벤트를 나타냅니다.

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

예제

다음 코드 예제에서 파생 하는 방법을 보여 줍니다는 WebApplicationLifetimeEvent 클래스 사용자 지정 이벤트를 만듭니다.


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;
        }
    }
}
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
    
    
    ' 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


    ' 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
    
    '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
End Class

다음 구성 파일에서는 구성 방법을 보여 줍니다 합니다 healthMonitoring 추가 하려면 구성 파일의 섹션을 SampleWebApplicationLifetimeEvent ASP.NET 상태 모니터링 시스템 위에 정의 된 코드입니다. 이벤트 시스템에 추가할 새 항목을 추가 하 여 이벤트를 정의 해야 합니다는 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>  

설명

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

애플리케이션 수명 이벤트에는 같은 애플리케이션 시작 및 종료 이벤트가 포함 됩니다. 애플리케이션이 종료 되는 경우에 관련된 이벤트 메시지 필드를 확인 하 여 이유를 확인할 수 있습니다.

경우는 WebApplicationLifetimeEvent ASP.NET 상태 모니터링 애플리케이션 수명 이벤트 성능 카운터를 업데이트 하는 인스턴스가 발생 합니다. 추가 하 여 이러한 이벤트를 기록할 수 있습니다는 WebApplicationLifetimeEvent 개체를 rules 하위 섹션는 healthMonitoring 다음 예제에서와 같이 구성 파일의 섹션입니다.

<rules>  
  <add name="Application Events"  
    eventName="Application Lifetime Events"  
    provider="EventLogProvider"  
    profile="Default"  
    minInterval="00:01:00" />  
</rules>  

애플리케이션 수명 이벤트 성능 카운터는 모든 ASP.NET 수명 이벤트의 합계를 포함합니다. 시스템 모니터 (PerfMon)에서이 성능 카운터를 볼 수는 카운터 추가 창 선택 ASP.NET 에서 합니다 성능 개체 드롭 다운 목록. 선택 합니다 애플리케이션 수명 이벤트 성능 카운터를 클릭 합니다 추가 단추입니다. 자세한 내용은 "ASP.NET 애플리케이션을 사용 하 여 시스템 모니터 (PerfMon) 사용"을 참조 하십시오 MSDN합니다. 표준EventLogWebEventProvider에 따라 이벤트를 기록하도록 허용하는 경우 애플리케이션 로그를 선택하여 이벤트 뷰어 볼 수 있습니다.

주의

때문에 WebApplicationLifetimeEvent 개체는 고용량 이벤트에 기록 리소스를 많이 사용 하 고 시스템 속도가 느려질 수 있습니다. 다른 이벤트의 경우 덮어 발생할 수도 있습니다는 EventLogWebEventProvider 작동 로깅 이벤트의 양이 많아 방법과 이벤트 클래스.

참고

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

상속자 참고

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

생성자

WebApplicationLifetimeEvent(String, Object, Int32)

제공된 매개 변수를 사용하여 WebApplicationLifetimeEvent 클래스를 초기화합니다.

WebApplicationLifetimeEvent(String, Object, Int32, Int32)

제공된 매개 변수를 사용하여 WebApplicationLifetimeEvent 클래스를 초기화합니다.

속성

EventCode

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

(다음에서 상속됨 WebBaseEvent)
EventDetailCode

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

(다음에서 상속됨 WebBaseEvent)
EventID

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

(다음에서 상속됨 WebBaseEvent)
EventOccurrence

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

(다음에서 상속됨 WebBaseEvent)
EventSequence

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

(다음에서 상속됨 WebBaseEvent)
EventSource

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

(다음에서 상속됨 WebBaseEvent)
EventTime

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

(다음에서 상속됨 WebBaseEvent)
EventTimeUtc

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

(다음에서 상속됨 WebBaseEvent)
Message

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

(다음에서 상속됨 WebBaseEvent)
ProcessInformation

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

(다음에서 상속됨 WebManagementEvent)

메서드

Equals(Object)

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

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

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

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

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

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

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

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

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

MemberwiseClone()

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

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

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

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

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

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

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

(다음에서 상속됨 WebBaseEvent)

적용 대상

추가 정보