CodeTrack: Profiling a process hosted in IIS

Back to How To

This can be used to profile any .NET code that is hosted within IIS.

For profiling IIS, it is necessary to run the profiler in elevated mode (you can do this by clicking on the elevation icon in the title bar, or run the profiler as admin).

  1. Select the collect tab (on the left of the application)
  2. Select ‘Process’ and click the arrow on the right to go to the next step.


  3. Now you can select the website, wcf service,... you want to profile. Use the dropdown button to select your code.

    If it's a website or wcf service, codetrack will try to give you a list of all instances in IIS. If yours is not listed, you can always select it manually.
    You will be asked to select the main dll of your application. This is necessary to determine bitness and the DotNet version. The bittness and DotNet version should be selected automatically. Should this be incorrect, you can still change this manually.

    Now click the arrow on the right to go to the next step.

  4. Now it's time to decide upon your level of detail. Important to remember, is that the more detail you require, the higher the impact profiling will have on your performance. If you just started investigating a problem, it might be a good idea to use the sampling option. Since this will be the most performant profiling mode. From this information you can then start another session with much more detail, profiling only the code that causes the performance issue.
    For more information about the different profiling settings, read Profiling Modes.


    Now we are ready for the last step, click on the right arrow to continue.

  5. In this last section you need to select the destination of the profiling data. (Make sure you select a location with enough space if you profile with lots of detail).

    If you need to profile on a very slow machine,one with little RAM, or a production server, you can disable the processing of the data. This allows you to do the number crunching offline on another machine.


    If you want to start profiling immediately, make sure you click the record button, otherwise click the pause button and hit record from the moment you want to start capturing data.
    Now you are ready to start profiling. If you click the play button, IIS will be restarted (this might take a while). Now you can browse to your website or start calling your wcf service.
    If you press the stop button Codetrack will reset IIS again (again: this might take a while).