Export (0) Print
Expand All

ProcessInfo Class

Provides information on processes currently executing.

System.Object
  System.Web.ProcessInfo

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public class ProcessInfo

The ProcessInfo type exposes the following members.

  NameDescription
Public methodProcessInfo()Initializes a new instance of the ProcessInfo class.
Public methodProcessInfo(DateTime, TimeSpan, Int32, Int32, ProcessStatus, ProcessShutdownReason, Int32)Initializes a new instance of the ProcessInfo class and sets internal information indicating the status of the process.
Top

  NameDescription
Public propertyAgeGets the length of time the process has been running.
Public propertyPeakMemoryUsedGets the maximum amount of memory the process has used.
Public propertyProcessIDGets the ID number assigned to the process.
Public propertyRequestCountGets the number of start requests for the process.
Public propertyShutdownReasonGets a value that indicates why the process shut down.
Public propertyStartTimeGets the time at which the process started.
Public propertyStatusGets the current status of the process.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSetAllSets internal information indicating the status of the process.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This class returns information about ASP.NET worker processes that are running under the ASP.NET process model. Objects of this type are returned by the static methods ProcessModelInfo.GetCurrentProcessInfo and ProcessModelInfo.GetHistory. These methods are the only useful ways to create an initialized object.

NoteNote

If you are using Microsoft Internet Information Services (IIS) 6.0, process metrics returned by the ProcessInfo classes are available only if you are running in IIS 5.0 isolation mode. If you are using IIS 6.0 in worker process isolation mode, the ASP.NET process model is disabled and an HttpException exception is thrown when you access ProcessInfo members.

The following code example demonstrates using the Age, PeakMemoryUsed, ProcessID, RequestCount, ShutdownReason, StartTime and Status properties of the ProcessInfo class. The example displays a LinkButton. When the LinkButton is clicked, the current process information is displayed.

<%@ 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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft