Share via


WorkerProcess.ProcessGuid Property

Definition

Gets the GUID for the worker process.

public:
 property System::String ^ ProcessGuid { System::String ^ get(); };
public string ProcessGuid { get; }
member this.ProcessGuid : string
Public ReadOnly Property ProcessGuid As String

Property Value

The GUID for the worker process.

Examples

The following example demonstrates how to enumerate the currently running worker processes and associated properties.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;

namespace AdministrationSnippets
{
    public class MicrosoftWebAdministrationWorkerProcess
    {
        public void EnumerateWorkerProcess()
        {
            ServerManager manager = new ServerManager();
            foreach (WorkerProcess proc in manager.WorkerProcesses)
            {
                Console.WriteLine("WorkerProcess found: {0}", proc.ProcessId);
                Console.WriteLine("\t|--AppPool : {0}", proc.AppPoolName);
                Console.WriteLine("\t|--ProcGuid: {0}", proc.ProcessGuid);
                Console.WriteLine("\t|--State   : {0}", proc.State.ToString());

                foreach (ApplicationDomain appDom in proc.ApplicationDomains)
                {
                    Console.WriteLine(
                        "\t+--ApplicationDomain Found: {0}", appDom.Id);
                    Console.WriteLine(
                        "\t\t|--AppDomPhysPath: {0}", appDom.PhysicalPath);
                    Console.WriteLine(
                        "\t\t+--AppDomVirtPath: {0}", appDom.VirtualPath);
                }
            }
        }
    }
}

Remarks

The Windows Process Activation Service maintains two keys for any worker process: a process identifier, which is a nonnegative integer, and a unique identifier, which is a GUID. A process identifier is recycled by the operating system, but each worker process GUID on a single computer is guaranteed to be unique. Therefore, you should use the GUID in a query to retrieve a worker process.

Applies to

See also