Aracılığıyla paylaş


WebProcessInformation Sınıf

Tanım

ASP.NET barındıran çalışan işlemi hakkında bilgi sağlar.

public ref class WebProcessInformation sealed
public sealed class WebProcessInformation
type WebProcessInformation = class
Public NotInheritable Class WebProcessInformation
Devralma
WebProcessInformation

Örnekler

Aşağıdaki örnekte iki bölüm vardır. birincisi, ASP.NET türünü kullanan özel bir olay kullanmasını sağlayan bir yapılandırma dosyasının alıntısıdır WebProcessInformation .

İkincisinde özel olayın nasıl uygulanacakları gösterilmektedir.

Özel olayınızın uygun zamanda, yani değiştireceği eşdeğer sistem durumu olayının tetiklendiğinde tetiklendiğinden emin olun.

<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>  

Aşağıdaki örnek, türünü kullanan özel bir olayın nasıl uygulandığını WebProcessInformation gösterir.


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

Açıklamalar

ASP.NET sistem durumu izleme, üretim ve operasyon personelinin dağıtılan Web uygulamalarını yönetmesine olanak tanır. Ad System.Web.Management alanı, uygulama sistem durumu verilerini paketlemeden sorumlu sistem durumu olay türlerini ve bu verileri işlemeden sorumlu sağlayıcı türlerini içerir. Ayrıca, sistem durumu olaylarının yönetimi sırasında yardımcı olan destekleyici türler içerir.

sınıfının örnekleri WebProcessInformation , türünden türetilen türlerden WebManagementEvent herhangi biri kullanılarak elde edilen bilgileri içerir.

Uygulamanızın bu tür tarafından sağlanan korumalı bilgilere erişmek için uygun izinlere sahip olması gerekir.

Aşağıdaki örnek, ASP.NET işlem bilgilerini içeren hata olaylarını günlüğe kaydetmesini sağlamak için kullanabileceğiniz yapılandırma dosyasının bir alıntısıdır.

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

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

</healthMonitoring>  

Not

Çoğu durumda, uygulanan ASP.NET sistem durumu izleme türlerini kullanabilir ve yapılandırma bölümünde değerleri healthMonitoring belirterek sistem durumu izleme sistemini denetleyebilirsiniz. Kendi özel olaylarınızı ve sağlayıcılarınızı oluşturmak için sistem durumu izleme türlerinden de türetebilirsiniz. Özel olay sınıfı oluşturma örneği için Örnek bölümüne bakın.

Özellikler

AccountName

Çalışan işleminin hesap adını alır.

ProcessID

İşlem tanımlayıcısını alır.

ProcessName

İşlemin adını alır.

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
FormatToString(WebEventFormatter)

Uygulama bilgilerini biçimlendirin.

GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır

Ayrıca bkz.