Share via


ProcessInfo クラス

現在実行されているプロセスに関する情報を提供します。

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

構文

'宣言
Public Class ProcessInfo
'使用
Dim instance As ProcessInfo
public class ProcessInfo
public ref class ProcessInfo
public class ProcessInfo
public class ProcessInfo
適用できません。

解説

このクラスは、ASP.NET プロセス モデルで実行されている ASP.NET ワーカー プロセスに関する情報を返します。この型のオブジェクトは、静的メソッド ProcessModelInfo.GetCurrentProcessInfo および ProcessModelInfo.GetHistory によって返されます。これらのメソッドは、初期化したオブジェクトを作成する唯一の有効な方法です。

メモメモ :

Microsoft Internet Information Services (IIS) 6.0 を使用している場合、ProcessInfo クラスによって返されるプロセス測度を使用できるのは、IIS 5.0 分離モードで実行しているときだけです。ワーカー プロセス分離モードで IIS 6.0 を使用している場合は、ProcessInfo のメンバにアクセスすると、ASP.NET プロセス モデルが無効になり、HttpException 例外がスローされます。

使用例

ProcessInfo クラスの AgePeakMemoryUsedProcessIDRequestCountShutdownReasonStartTime、および Status の各プロパティを使用したコード例を次に示します。この例では、LinkButton を表示します。LinkButton をクリックすると、現在のプロセス情報が表示されます。

<%@ Page language="vb" AutoEventWireup="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ASP.NET Example</title>
<script language="vb" runat="server">     
      Sub GetProcessInfo(sender As Object, e As System.EventArgs)
        Dim pi As ProcessInfo

        'Get information about the current process.
        pi = ProcessModelInfo.GetCurrentProcessInfo()

        Literal1.Text = "<p>Age: " & pi.Age.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>PeakMemoryUsed: " & pi.PeakMemoryUsed.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>ProcessID: " & pi.ProcessID.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>RequestCount: " & pi.RequestCount.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>ShutdownReason: " & pi.ShutdownReason.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>StartTime: " & pi.StartTime.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>Status: " & pi.Status.ToString & "</p>"
      End Sub
    </script>
  </head>
  <body>
    <form id="WebForm2" method="post" runat="server">
      <asp:button id="Button1" OnClick="GetProcessInfo" runat="server" Text="Get Process Info"></asp:button>
            &nbsp;
      <asp:Literal id="Literal1" runat="server"></asp:Literal>
    </form>
  </body>
</html>
<%@ Page language="c#" AutoEventWireup="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ASP.NET Example</title>
<script language="c#" runat="server">     
      void GetProcessInfo(Object sender, EventArgs e) 
      {
        ProcessInfo pi;

        // Get the current process information.
        pi = ProcessModelInfo.GetCurrentProcessInfo();

        Literal1.Text = "<p>Age: " + pi.Age + "</p>";
        Literal1.Text += "<p>PeakMemoryUsed: " + pi.PeakMemoryUsed + "</p>";
        Literal1.Text += "<p>ProcessID: " + pi.ProcessID + "</p>";
        Literal1.Text += "<p>RequestCount: " + pi.RequestCount + "</p>";
        Literal1.Text += "<p>ShutdownReason: " + pi.ShutdownReason + "</p>";
        Literal1.Text += "<p>StartTime: " + pi.StartTime + "</p>";
        Literal1.Text += "<p>Status: " + pi.Status + "</p>";
      }
      </script>
    </head>
    <body>
    <form id="WebForm1" method="post" runat="server">
      <asp:button id="Button1" OnClick="GetProcessInfo" runat="server" Text="Get Process Info"></asp:button>
            &nbsp;
      <asp:Literal id="Literal1" runat="server"></asp:Literal>
    </form>
  </body>
</html>

.NET Framework のセキュリティ

  • AspNetHostingPermission  (ホスト環境での動作に必要なアクセス許可) 要求値 : LinkDemand; アクセス許可値 : Minimal
  • AspNetHostingPermission  (ホスト環境での動作に必要なアクセス許可) 要求値 : InheritanceDemand; アクセス許可値 : Minimal

継承階層

System.Object
  System.Web.ProcessInfo

スレッド セーフ

この型の public static (Visual Basicでは共有) メンバはすべて,スレッド セーフです。インスタンス メンバの場合は,スレッド セーフであるとは限りません。

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

ProcessInfo メンバ
System.Web 名前空間

その他の技術情報

processModel 要素 (ASP.NET 設定スキーマ)