WebApplicationLifetimeEvent 构造函数

定义

初始化 WebApplicationLifetimeEvent 类的新实例。Initializes a new instance of the WebApplicationLifetimeEvent class.

重载

WebApplicationLifetimeEvent(String, Object, Int32)

使用所提供的参数初始化 WebApplicationLifetimeEvent 类。Initializes the WebApplicationLifetimeEvent class using the supplied parameters.

WebApplicationLifetimeEvent(String, Object, Int32, Int32)

使用所提供的参数初始化 WebApplicationLifetimeEvent 类。Initializes the WebApplicationLifetimeEvent class using the supplied parameters.

WebApplicationLifetimeEvent(String, Object, Int32)

使用所提供的参数初始化 WebApplicationLifetimeEvent 类。Initializes the WebApplicationLifetimeEvent class using the supplied parameters.

protected public:
 WebApplicationLifetimeEvent(System::String ^ message, System::Object ^ eventSource, int eventCode);
protected internal WebApplicationLifetimeEvent (string message, object eventSource, int eventCode);
new System.Web.Management.WebApplicationLifetimeEvent : string * obj * int -> System.Web.Management.WebApplicationLifetimeEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer)

参数

message
String

与事件关联的消息。The message associated with the event.

eventSource
Object

作为事件源的对象。The object that is the source of the event.

eventCode
Int32

与该事件关联的代码。The code associated with the event. 实现自定义事件时,事件代码必须大于 WebExtendedBaseWhen you implement a custom event, the event code must be greater than WebExtendedBase.

示例

下面的代码示例演示如何 WebApplicationLifetimeEvent 在 ASP.NET 自定义运行状况事件中使用。The following code example shows how to use the WebApplicationLifetimeEvent in an ASP.NET custom health event. 此代码示例主要用于显示要使用的正确语法。This code example is mainly intended to show the correct syntax to use.

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

注解

此构造函数由 ASP.NET health 监视系统在内部使用。This constructor is used internally by the ASP.NET health-monitoring system. 你永远不会使用它来创建类的实例 WebApplicationLifetimeEvent ,但可以在实现继承自此类的事件类型时调用此构造函数。You will never use it to create an instance of the WebApplicationLifetimeEvent class, but you can call this constructor when implementing your own event type that inherits from this class.

备注

WebApplicationLifetimeEvent构造函数不应在代码中直接使用。The WebApplicationLifetimeEvent constructor is not intended to be used directly from your code. 它由 ASP.NET 调用。It is called by ASP.NET. WebApplicationLifetimeEvent从类派生时,可以调用构造函数 WebApplicationLifetimeEventYou can call the WebApplicationLifetimeEvent constructor when deriving from the WebApplicationLifetimeEvent class.

适用于

WebApplicationLifetimeEvent(String, Object, Int32, Int32)

使用所提供的参数初始化 WebApplicationLifetimeEvent 类。Initializes the WebApplicationLifetimeEvent class using the supplied parameters.

protected public:
 WebApplicationLifetimeEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, int eventDetailCode);
protected internal WebApplicationLifetimeEvent (string message, object eventSource, int eventCode, int eventDetailCode);
new System.Web.Management.WebApplicationLifetimeEvent : string * obj * int * int -> System.Web.Management.WebApplicationLifetimeEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, eventDetailCode As Integer)

参数

message
String

与事件关联的消息。The message associated with the event.

eventSource
Object

作为事件源的对象。The object that is the source of the event.

eventCode
Int32

与该事件关联的代码。The code associated with the event. 实现自定义事件时,事件代码必须大于 WebExtendedBaseWhen you implement a custom event, the event code must be greater than WebExtendedBase.

eventDetailCode
Int32

用于指定事件的详细标识符的 WebEventCodes 值。The WebEventCodes value that specifies the detailed identifier for the event.

示例

下面的代码示例演示如何 WebApplicationLifetimeEvent 在 ASP.NET 自定义运行状况事件中使用。The following code example shows how to use the WebApplicationLifetimeEvent in an ASP.NET custom health event. 此代码示例主要用于显示要使用的正确语法。This code example is mainly intended to show the correct syntax to use.

// 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());
}

' 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

注解

此构造函数由 ASP.NET health 监视系统在内部使用。This constructor is used internally by the ASP.NET health-monitoring system. 你永远不会使用它来创建类的实例 WebApplicationLifetimeEvent ,但可以在实现继承自此类的事件类型时调用此构造函数。You will never use it to create an instance of the WebApplicationLifetimeEvent class, but you can call this constructor when implementing your own event type that inherits from this class.

备注

WebApplicationLifetimeEvent构造函数不应在代码中直接使用。The WebApplicationLifetimeEvent constructor is not intended to be used directly from your code. 它由 ASP.NET 调用。It is called by ASP.NET. WebApplicationLifetimeEvent从类派生时,可以调用构造函数 WebApplicationLifetimeEventYou can call the WebApplicationLifetimeEvent constructor when deriving from the WebApplicationLifetimeEvent class.

适用于