WebErrorEvent 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
시스템 오류에 대한 정보를 제공합니다.
public ref class WebErrorEvent : System::Web::Management::WebBaseErrorEvent
public class WebErrorEvent : System.Web.Management.WebBaseErrorEvent
type WebErrorEvent = class
inherit WebBaseErrorEvent
Public Class WebErrorEvent
Inherits WebBaseErrorEvent
- 상속
예제
다음 코드 예제에서는 클래스에서 WebErrorEvent 파생하여 사용자 지정 이벤트를 만드는 방법을 보여줍니다.
또한 ASP.NET 이 사용자 지정 이벤트를 사용할 수 있도록 하는 구성 파일의 발췌 내용도 나와 있습니다.
<healthMonitoring
enabled="true" heartBeatInterval="0">
<eventMappings>
<add name="SampleWebErrorEvent" type="SamplesAspNet.SampleWebErrorEvent,weberrorevent,Version=1.0.1573.21549, Culture=neutral, PublicKeyToken=2a0b23915ac7352b, processorArchitecture=MSIL"/>
</eventMappings>
<profiles>
<add name="Custom"
minInstances="1"
maxLimit="Infinite"
minInterval="00:00:00" />
</profiles>
<rules>
<clear />
<add name="Custom Web Error Event"
eventName="SampleWebErrorEvent"
provider="EventLogProvider"
profile="Custom" />
</rules>
</healthMonitoring>
using System;
using System.Text;
using System.Web;
using System.Web.Management;
namespace Samples.AspNet.Management
{
// Implements a custom WebErrorEvent class.
public class SampleWebErrorEvent : WebErrorEvent
{
private StringBuilder eventInfo;
// Invoked in case of events identified
// only by their event code.
public SampleWebErrorEvent(string msg,
object eventSource, int eventCode, Exception e)
:
base(msg, eventSource, eventCode, e)
{
// 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 SampleWebErrorEvent(string msg,
object eventSource, int eventCode,
int detailedCode, Exception e):
base(msg, eventSource,
eventCode, detailedCode, e)
{
// Perform custom initialization.
eventInfo = new StringBuilder();
eventInfo.Append(string.Format(
"Event created at: ", EventTime.ToString()));
}
// Raises the SampleWebErrorEvent.
public override void Raise()
{
// Perform custom processing.
eventInfo.Append(string.Format(
"Event raised at: ", EventTime.ToString()));
// Raise the event.
base.Raise();
}
// Obtains the current request information.
public string GetRequestInfo()
{
string reqInfo = GetRequestInfo();
return reqInfo;
}
// Obtains the current thread information.
public string GetThreadInfo()
{
string threadInfo = GetThreadInfo();
return threadInfo;
}
// Obtains the current process information.
public string GetProcessInfo()
{
string procInfo = GetProcessInfo();
return procInfo;
}
//Formats Web request event information..
public override void FormatCustomEventDetails(
WebEventFormatter formatter)
{
base.FormatCustomEventDetails(formatter);
// Add custom data.
formatter.AppendLine("");
formatter.IndentationLevel += 1;
formatter.AppendLine(
"** SampleWebErrorEvent Start **");
formatter.AppendLine(eventInfo.ToString());
formatter.AppendLine(
"** SampleWebBaseErrorEvent End **");
formatter.IndentationLevel -= 1;
}
}
}
Imports System.Text
Imports System.Web
Imports System.Web.Management
' Implements a custom WebErrorEvent class.
Public Class SampleWebErrorEvent
Inherits WebErrorEvent
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, ByVal e As Exception)
MyBase.New(msg, eventSource, eventCode, e)
' 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 detailedCode As Integer, ByVal e As Exception)
MyBase.New(msg, eventSource, _
eventCode, detailedCode, e)
' Perform custom initialization.
eventInfo = New StringBuilder()
eventInfo.Append(String.Format( _
"Event created at: ", EventTime.ToString()))
End Sub
' Raises the SampleWebErrorEvent.
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 request information.
Public Function GetRequestInfo() As String
Dim reqInfo As String = GetRequestInfo()
Return reqInfo
End Function 'GetRequestInfo
' Obtains the current thread information.
Public Function GetThreadInfo() As String
Dim threadInfo As String = GetThreadInfo()
Return threadInfo
End Function 'GetThreadInfo
' Obtains the current process information.
Public Function GetProcessInfo() As String
Dim procInfo As String = GetProcessInfo()
Return procInfo
End Function 'GetProcessInfo
'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.AppendLine( _
"** SampleWebErrorEvent Start **")
formatter.AppendLine(eventInfo.ToString())
formatter.AppendLine( _
"** SampleWebBaseErrorEvent End **")
formatter.IndentationLevel -= 1
End Sub
End Class
설명
ASP.NET 상태 모니터링을 사용하면 프로덕션 및 운영 직원이 배포된 웹 애플리케이션을 관리할 수 있습니다. 네임스페이스에는 System.Web.Management 애플리케이션 상태 데이터 패키징을 담당하는 상태 이벤트 유형과 이 데이터 처리를 담당하는 공급자 유형이 포함됩니다. 또한 상태 이벤트를 관리하는 동안 도움이 되는 지원 유형도 포함합니다.
구성 WebErrorEvent 또는 애플리케이션 코드 문제로 인한 오류에 대한 정보를 제공합니다. 예를 들어 페이지에서 오류가 발견되면 ASP.NET 오류가 발생합니다.
메모
대부분의 경우 구현된 ASP.NET 상태 모니터링 유형을 사용할 수 있으며 healthMonitoring 구성 섹션에서 값을 지정하여 상태 모니터링 시스템을 제어합니다. 상태 모니터링 형식에서 파생하여 고유한 사용자 지정 이벤트 및 공급자를 만들 수도 있습니다. 클래스에서 파생되는 예제는 WebErrorEvent 이 항목에 제공된 예제를 참조하세요.
생성자
| Name | Description |
|---|---|
| WebErrorEvent(String, Object, Int32, Exception) |
제공된 매개 변수를 WebErrorEvent 사용하여 클래스를 초기화합니다. |
| WebErrorEvent(String, Object, Int32, Int32, Exception) |
제공된 매개 변수를 사용하여 클래스의 WebErrorEvent 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| ErrorException |
Exception 오류와 연결된 값을 가져옵니다. (다음에서 상속됨 WebBaseErrorEvent) |
| EventCode |
이벤트와 연결된 코드 값을 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| EventDetailCode |
이벤트 세부 정보 코드를 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| EventID |
이벤트와 연결된 식별자를 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| EventOccurrence |
이벤트가 발생한 횟수를 나타내는 카운터를 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| EventSequence |
애플리케이션에서 이벤트가 발생한 횟수를 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| EventSource |
이벤트를 발생시키는 개체를 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| EventTime |
이벤트가 발생한 시간을 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| EventTimeUtc |
이벤트가 발생한 시간을 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| Message |
이벤트를 설명하는 메시지를 가져옵니다. (다음에서 상속됨 WebBaseEvent) |
| ProcessInformation |
ASP.NET 애플리케이션 호스팅 프로세스에 대한 정보를 가져옵니다. (다음에서 상속됨 WebManagementEvent) |
| RequestInformation |
애플리케이션 요청 정보를 가져옵니다. |
| ThreadInformation |
애플리케이션 스레드 정보를 가져옵니다. |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| FormatCustomEventDetails(WebEventFormatter) |
이벤트 정보의 표준 서식을 제공합니다. (다음에서 상속됨 WebBaseEvent) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| IncrementPerfCounters() |
성능 카운터를 증가시키려면 내부적으로 사용됩니다. |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| Raise() |
구성된 공급자에게 이벤트가 발생했음을 알려 이벤트를 발생합니다. (다음에서 상속됨 WebBaseEvent) |
| ToString() |
표시를 위해 이벤트 정보의 형식을 지정합니다. (다음에서 상속됨 WebBaseEvent) |
| ToString(Boolean, Boolean) |
표시를 위해 이벤트 정보의 형식을 지정합니다. (다음에서 상속됨 WebBaseEvent) |