다음을 통해 공유


WebProcessInformation 클래스

정의

ASP.NET을 호스팅하는 작업자 프로세스에 대한 정보를 제공합니다.

public ref class WebProcessInformation sealed
public sealed class WebProcessInformation
type WebProcessInformation = class
Public NotInheritable Class WebProcessInformation
상속
WebProcessInformation

예제

다음 예는 두 부분으로 구성됩니다. 첫 번째는 ASP.NET을 사용 하는 사용자 지정 이벤트를 사용할 수 있도록 하는 구성 파일의 일부는 WebProcessInformation 형식입니다.

두 번째 사용자 지정 이벤트를 구현 하는 방법을 보여 줍니다.

사용자 지정 이벤트가 발생 하는지 적절 한 시기, 이벤트가 발생할 때 해당 하는 시스템 상태를 대체는 수를 확인 합니다.

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

    <eventMappings>  
      <add    
        name="SampleProcessInformation"   
        type="SamplesAspNet.SampleWebProcessInformation, webprocessinformation, Version=1.0.1585.27289, Culture=neutral, PublicKeyToken=3648e5c763a8239f, processorArchitecture=MSIL"/>  
    </eventMappings>  

    <rules>  
      <add   
        name="Custom Process Information"  
        eventName="SampleProcessInformation"   
        provider="EventLogProvider"  
        profile="Default"/>  
    </rules>  

</healthMonitoring>  

다음 예제를 사용 하는 사용자 지정 이벤트를 구현 하는 방법을 보여 줍니다는 WebProcessInformation 형식입니다.


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

namespace SamplesAspNet
{
    // Implements a custom WebBaseEvent type that 
    // uses WebProcessInformation.
    public class SampleWebProcessInformation: 
        WebManagementEvent
    {
        private StringBuilder eventInfo;
        // Instantiate SampleWebProcessInformation.    
        public SampleWebProcessInformation(string msg, 
            object eventSource, int eventCode) : 
        base(msg, eventSource, eventCode)
        {
            // Perform custom initialization.
            eventInfo = new StringBuilder();
            eventInfo.Append(string.Format(
            "Event created at: {0}", 
            EventTime.ToString()));
        }   

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

            // Raise the event.
            base.Raise();
        }

        public string GetAccountName()
        {
            // Get the name of the account.
            return (string.Format(
                "Account name: {0}", 
                ProcessInformation.AccountName));
        }

        public string GetProcessId()
        {
            // Get the process identifier.
            return (string.Format(
                "Process Id: {0}", 
                ProcessInformation.ProcessID.ToString()));
        }

        public string GetProcessName()
        {
            // Get the requests in execution.
            return (string.Format(
                "Process name: {0}", 
                ProcessInformation.ProcessName));
        }

        //Formats Web request event information.
        public override void FormatCustomEventDetails(
            WebEventFormatter formatter)
        {
            base.FormatCustomEventDetails(formatter);

            // Add custom data.
            formatter.AppendLine("Custom Process Information:");
            formatter.IndentationLevel += 1;

            // Display the process information.
            formatter.AppendLine(GetAccountName());
            formatter.AppendLine(GetProcessId());
            formatter.AppendLine(GetProcessName());
            formatter.IndentationLevel -= 1;
            formatter.AppendLine(eventInfo.ToString());
        }
    }
}
Imports System.Text
Imports System.Web
Imports System.Web.Management


' Implements a custom WebBaseEvent type that 
' uses WebProcessInformation.

Public Class SampleWebProcessInformation
   Inherits WebBaseEvent
   Private eventInfo As StringBuilder
    Private Shared processInformation _
    As WebProcessInformation
   
   ' Instantiate SampleWebProcessInformation.    
    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: {0}", _
        EventTime.ToString()))

    End Sub
   
   ' Raises the event.
   Public Overrides Sub Raise()
      ' Perform custom processing. 
        eventInfo.Append(String.Format( _
        "Event raised at: {0}", _
        EventTime.ToString()))
      
      ' Raise the event.
      MyBase.Raise()
   End Sub
   
   Public Function GetAccountName() As String
      ' Get the name of the account.
        Return String.Format("Account name: {0}", _
        processInformation.AccountName)
   End Function 'GetAccountName
   
   Public Function GetProcessId() As String
      ' Get the process identifier.
        Return String.Format("Process Id: {0}", _
        processInformation.ProcessID.ToString())
   End Function 'GetProcessId
   
   Public Function GetProcessName() As String
      ' Get the requests in execution.
        Return String.Format("Process name: {0}", _
        ProcessInformation.ProcessName)
   End Function 'GetProcessName
   
    'Formats Web request event information.
    Public Overrides Sub FormatCustomEventDetails( _
    ByVal formatter _
    As System.Web.Management.WebEventFormatter)
        MyBase.FormatCustomEventDetails(formatter)
   
        ' Add custom data.
        formatter.AppendLine("")
        formatter.AppendLine( _
        "Custom Process Information:")
        formatter.IndentationLevel += 1

        ' Display the process information.
        formatter.AppendLine(GetAccountName())
        formatter.AppendLine(GetProcessId())
        formatter.AppendLine(GetProcessName())
        formatter.IndentationLevel -= 1
        formatter.AppendLine(eventInfo.ToString())
    End Sub

End Class

설명

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

인스턴스를 WebProcessInformation 클래스에서 파생 된 형식 중 하나를 사용 하 여 얻은 정보를 포함 합니다 WebManagementEvent 형식입니다.

애플리케이션에이 형식에서 제공 하는 보호 된 정보를 액세스 하는 적절 한 권한이 필요 합니다.

다음 예제에는 ASP.NET 프로세스 정보를 포함 하는 오류 이벤트 로그를 사용 하도록 설정 하는 데 수 구성 파일의 일부입니다.

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

    <rules>  
     <add   
       name="All Errors Default"  
       eventName="All Errors"  
       provider="EventLogProvider"  
       profile="Default"  
       minInterval="00:01:00" />  
    </rules>  

</healthMonitoring>  

참고

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

속성

AccountName

작업자 프로세스의 계정 이름을 가져옵니다.

ProcessID

프로세스 식별자를 가져옵니다.

ProcessName

프로세스의 이름을 가져옵니다.

메서드

Equals(Object)

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

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

애플리케이션 정보의 서식을 지정합니다.

GetHashCode()

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

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

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

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

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

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

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보