Determine which w3wp.exe process belongs to which App Pool in Windows 7 / IIS7.5?

后端 未结 4 735
暖寄归人
暖寄归人 2021-01-31 15:47

I\'ve recently upgraded my development machine from Windows XP to Windows 7. How can I tell which w3wp.exe process belongs to which App Pool on a desktop running Windows 7?

4条回答
  •  鱼传尺愫
    2021-01-31 16:39

    I know this is an old post, but here is a way to enumerate the app pool and process IDs using C# code.

    void Main()
    {
        using (var serverManager = new ServerManager())
        {
            foreach (var appPool in serverManager.ApplicationPools)
            {
                string.Format("App pool name = {0}", appPool.Name).Dump();
    
                foreach (var workerProcess in appPool.WorkerProcesses)
                {
                    string.Format("Process id = {0}", workerProcess.ProcessId).Dump();
                }
            }
    
            "Done".Dump();
        }
    }
    

    Make sure you reference Microsoft.Web.Administration.dll in %WINDIR%\System32\inetsrv.

    If you don't have LINQPad, replace the dumps with Console.WriteLine(s)

提交回复
热议问题