Identifying Worker Process (w3wp.exe) – IIS 6.0 and IIS 7.0 for Debugging ASP.NET Application

If you are debugging a ASP.NET web application which is hosted on IIS, you need to attach the particular worker process in Visual Studio to start debugging. To Attach a process we can go to Tools > Attach Process or use shortcut key Ctrl +P. The process window will show the worker process (w3wp.exe) which is currently running on IIS. You need to select the process and click on attach button to start the debugging.
Problem starts when you have multiple worker process running on IIS.  If you have multiple sites hosted on IIS and each site having their own application pool then you will see the list of all worker process in the Process Attach window.


Here  you need to identify the particular worker process which is associated with your application pool.

Note: Whenever we create a new Application Pool, the ID of the Application Pool is being generated and it’s registered with the HTTP.SYS (Kernel Level of IIS) . So whenever HTTP.SYS Received the request from any web application,  it checks for the Application Pool and based on the application pool it send the request

To know more about IIS Request Process, here is one of my aticle How IIS Process ASP.NET Request

Identify Worker Process in IIS 6.0

• Start > Run > Cmd
• Go To Windows > System32
• Run cscript iisapp.vbs
• You will get the list of Running Worker ProcessID and the Application Pool Name.


So, here is your list of all worker process with corresponding application pool name.  From  the Application pool name you can easily identify which worker process is related with your application.

Identify Worker Process in IIS 7.0


From IIS 7.0 you need you to run IIS Command Tool ( appcmd ) .
• Start > Run > Cmd
• Go To Windows > System32 > Inetsrv
• Run appcmd list wp

This will show you list worker process that is running on IIS 7.0 in the similar format of IIS 6.0

List of IIS Article Published by Me

Beginner’s Guide : Exploring IIS 6.0 With ASP.NET
Debug Your ASP.NET Application that Hosted on IIS : Process Attach and Identify which process to attach
Remote IIS Debugging : Debug your ASP.NET Application which is hosted on “Remote IIS Server”
How IIS Process ASP.NET Request

 
Shout it

ASP.NET, IIS , , ,

44 comments

  1. Pingback: DotNetShoutout
  2. Hi Very good article, solved my problem with sharepoint foundation 2010 – could not use the sharepoint lib from VS, without getting then error “file not found…?”.

    thanks
    Lars

    Like

  3. Hi Abhijit

    Here is my problem :

    I have made a .net asp project using sharepoint.dll (sharepoint foundation 2010)
    but then i run the code i get “filenotfound”, if i write the url in my browser i have no problem with acessing the site.
    I only get the problem then i call spsite from a asp.net app, and run it from visualstudio, if i deploy it to my IIS it works fine?.

    and i can also make a winform app and run if from visualstudio calling the same code with no problem, so it’s only
    then i’m running the asp.net project from VS i get the problem.

    br.
    Lars

    i’m using windows7 64bit, visual studio 2010. and sharepoint foundation. and IIS 7

    my code:

    default.aspx.cs:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.SharePoint;

    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    SPSite _MySite = new SPSite(“http://lpddell/”);
    SPWeb _MyWeb = _MySite.OpenWeb();
    }
    }
    ———–Default.aspx——————-

    Like

  4. Hi,

    Really nice article! And I appreciate that you covered both IIS 6 and 7.

    If you want, take a look at a VS 2010 Extension I have written: WADA.

    What it does: It finds the running W3WP processes and their application pools + allows to directly attach to that process for debugging purposes.

    You can find a description on my blog:

    http://angler.wordpress.com

    Like

    1. Hi Martin,
      Great to know you liked it. Reagarding the extension, I have had started to developing the same few months back after posting this blog post. This is quite difficult when we are having multiple app pool running over IIS and need to attached a particular porcess. My plan was to enable some features when i can show the particular worker process that is related to that web site. I am also most done with the work. I am now just looking for which is the best place to put my extension in visual studio. I hope to share it very soon.
      Cheers
      Abhijit

      Like

  5. For IIS7 you can just use the GUI. IIS manager–>Server–>Worker Processes there is no need to enter the command line.

    Like

  6. hey abhijit ..nice articles…m new to .net n windows azure…i hav a problem cited below hope u can help me wid this.

    After i create a cloud project and add a asp.net web role, i run the project and i get a blank page in the browser. I then changed the http web activation thing in d windows features on or off place…still i hav been facing this problem since two days…hope u can help me out 🙂

    Like

  7. I always reading your articles.
    also i am getting so many knowledge in your tip and trick.
    You are genius and exalant .
    I am from Orissa(Bhubaneshow)

    Thanks & Regards
    Tofan Nayak

    Like

  8. Mostly i can get details around Worker Process but what exactly it is am unable to get it. If you let me know it would be very helpful

    Like

  9. Thanks for sharing your info on this.

    Wouldn’t it be even better if IIS can assign a title to each worker process? It could take names from application pools.

    Like

Leave a comment