WebThreadInformationとは? わかりやすく解説

WebThreadInformation クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

ASP.NET プロセススレッドの状態に関する情報提供します

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public NotInheritable Class
 WebThreadInformation
Dim instance As WebThreadInformation
public sealed class WebThreadInformation
public ref class WebThreadInformation sealed
public final class WebThreadInformation
public final class WebThreadInformation
解説解説
使用例使用例

次のコードは、2 つ部分構成されます。最初は、ASP.NETWebThreadInformation 型のカスタム イベント使用できるようにする構成ファイル抜粋です。その次は、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());

        }

    }
}

.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.Web.Management.WebThreadInformation
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebThreadInformation メンバ
System.Web.Management 名前空間
WebErrorEvent クラス
WebRequestErrorEvent クラス
WebManagementEvent クラス
その他の技術情報
healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebThreadInformation プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

WebThreadInformation クラス
System.Web.Management 名前空間
WebErrorEvent クラス
WebRequestErrorEvent クラス
WebManagementEvent クラス

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebThreadInformation メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

WebThreadInformation クラス
System.Web.Management 名前空間
WebErrorEvent クラス
WebRequestErrorEvent クラス
WebManagementEvent クラス

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebThreadInformation メンバ

ASP.NET プロセススレッドの状態に関する情報提供します

WebThreadInformation データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

WebThreadInformation クラス
System.Web.Management 名前空間
WebErrorEvent クラス
WebRequestErrorEvent クラス
WebManagementEvent クラス

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「WebThreadInformation」の関連用語

WebThreadInformationのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebThreadInformationのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS