WebThreadInformation クラス
アセンブリ: System.Web (system.web.dll 内)


運用および操作の担当者は、ASP.NET Health Monitoring を使用して、配置されている Web アプリケーションを管理できます。System.Web.Management 名前空間には、アプリケーションの状態データをパッケージ化する状態イベント型、およびそのデータを処理するプロバイダ型が含まれます。また、状態イベント管理を支援するサポート型も含まれます。
WebThreadInformation クラスのインスタンスには、WebErrorEvent 型または WebRequestErrorEvent 型を使用して取得される情報が格納されます。
この型が提供する保護された情報にアクセスするには、アプリケーションに適切なアクセス許可が必要です。
![]() |
---|
ほとんどの場合、ASP.NET 状態監視型はそのままの実装で使用できます。ASP.NET Health Monitoring system の制御は healthMonitoring 構成セクションに値を指定することによって行います。状態監視型の派生として独自のイベントおよびプロバイダを作成することもできます。カスタム イベント クラスの作成例については、このトピックの例を参照してください。 |

次のコードは、2 つの部分で構成されます。最初は、ASP.NET で WebThreadInformation 型のカスタム イベントを使用できるようにする構成ファイルの抜粋です。その次は、WebThreadInformation 型を使用したカスタム イベントを実装する方法です。
作成するカスタム イベントは、必ず適切なタイミングで、つまり、置き換える対象のシステム状態イベントと同じタイミングで発生するようにしてください。
<healthMonitoring heartBeatInterval="0" enabled="true"> <profiles> <add name="Custom" minInstances="1" maxLimit="Infinite" minInterval="00:00:00" /> </profiles> <eventMappings> <add name="SampleWebThreadInformation" type="SamplesAspNet.SampleWebThreadInformation,webthreadinformation, Version=1.0.1782.29648, Culture=neutral, PublicKeyToken=b3283a2de7dd3f27, processorArchitecture=MSIL" /> </eventMappings> <rules> <add name="Custom Web Thread Info Event" eventName="SampleWebThreadInformation" provider="EventLogProvider" profile="Custom" /> </rules> </healthMonitoring>
Imports System Imports System.Text Imports System.Web Imports System.Web.Management ' Implements a custom WebErrorstEvent that uses the ' WebThreadInformation. Public Class SampleWebThreadInformation Inherits WebErrorEvent Private eventInfo As StringBuilder ' Instantiate 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: {0}", EventTime.ToString())) End Sub 'New ' 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 'Raise ' Get the impersonation mode. Public Function GetThreadImpersonation() As String Return String.Format( _ "Is impersonating: {0}", _ ThreadInformation.IsImpersonating.ToString()) End Function 'GetThreadImpersonation ' Get the stack trace. Public Function GetThreadStackTrace() As String Return String.Format( _ "Stack trace: {0}", _ ThreadInformation.StackTrace) End Function 'GetThreadStackTrace ' Get the account name. Public Function GetThreadAccountName() As String Return String.Format( _ "Request user host address: {0}", _ ThreadInformation.ThreadAccountName) End Function 'GetThreadAccountName ' Get the task Id. Public Function GetThreadId() As String ' Get the request principal. Return String.Format( _ "Thread Id: {0}", _ ThreadInformation.ThreadID.ToString()) End Function 'GetThreadId ' Formats Web request event information. Public Overrides Sub FormatCustomEventDetails( _ ByVal formatter As WebEventFormatter) ' Add custom data. formatter.AppendLine("") formatter.AppendLine( _ "Custom Thread Information:") formatter.IndentationLevel += 1 ' Display the thread information obtained formatter.AppendLine(GetThreadImpersonation()) formatter.AppendLine(GetThreadStackTrace()) formatter.AppendLine(GetThreadAccountName()) formatter.AppendLine(GetThreadId()) formatter.IndentationLevel -= 1 formatter.AppendLine(eventInfo.ToString()) End Sub 'FormatCustomEventDetails End Class 'SampleWebThreadInformation
using System; using System.Text; using System.Web; using System.Web.Management; namespace SamplesAspNet { // Implements a custom WebErrorstEvent that uses the // WebThreadInformation. public class SampleWebThreadInformation : WebErrorEvent { private StringBuilder eventInfo; // Instantiate events identified // only by their event code. public SampleWebThreadInformation( 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: {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(); } // Get the impersonation mode. public string GetThreadImpersonation() { return (string.Format( "Is impersonating: {0}", ThreadInformation.IsImpersonating.ToString())); } // Get the stack trace. public string GetThreadStackTrace() { return (string.Format( "Stack trace: {0}", ThreadInformation.StackTrace)); } // Get the account name. public string GetThreadAccountName() { return (string.Format( "Request user host address: {0}", ThreadInformation.ThreadAccountName)); } // Get the task Id. public string GetThreadId() { // Get the request principal. return (string.Format( "Thread Id: {0}", ThreadInformation.ThreadID.ToString())); } // Formats Web request event information. public override void FormatCustomEventDetails( WebEventFormatter formatter) { // Add custom data. formatter.AppendLine(""); formatter.AppendLine( "Custom Thread Information:"); formatter.IndentationLevel += 1; // Display the thread information obtained formatter.AppendLine(GetThreadImpersonation()); formatter.AppendLine(GetThreadStackTrace()); formatter.AppendLine(GetThreadAccountName()); formatter.AppendLine(GetThreadId()); formatter.IndentationLevel -= 1; formatter.AppendLine(eventInfo.ToString()); } } }


System.Web.Management.WebThreadInformation


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


WebThreadInformation プロパティ

名前 | 説明 | |
---|---|---|
![]() | IsImpersonating | 現在のスレッド偽装モードを取得します。 |
![]() | StackTrace | 現在のスレッド管理スタック トレースを取得します。 |
![]() | ThreadAccountName | スレッド アカウント名を取得します。 |
![]() | ThreadID | 現在のスレッドの識別子を取得します。 |

WebThreadInformation メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | FormatToString | スレッド関連情報を書式設定します。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

WebThreadInformation メンバ
ASP.NET プロセスのスレッドの状態に関する情報を提供します。
WebThreadInformation データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | IsImpersonating | 現在のスレッド偽装モードを取得します。 |
![]() | StackTrace | 現在のスレッド管理スタック トレースを取得します。 |
![]() | ThreadAccountName | スレッド アカウント名を取得します。 |
![]() | ThreadID | 現在のスレッドの識別子を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | FormatToString | スレッド関連情報を書式設定します。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からWebThreadInformationを検索する場合は、下記のリンクをクリックしてください。

- WebThreadInformationのページへのリンク