ANTS Performance Profiler 10

Profiling ASP.NET applications running on IIS

Profiling ASP.NET applications on IIS requires a little more configuration than a basic .NET executable. You specify a URL for the application, the relevant server options, and  choose a profiling mode and performance counters. However, the settings you need depend on the version of IIS you are running, and the ports your application is using.

You can also use this type of profiling session to profile WCF services running on IIS.

This article steps through both processes and explains the additional options you can choose.

You can only profile ASP.NET applications running on the computer where the profiler is installed.

If you're profiling a HTTPS website, you may see browser warnings, which you can safely ignore. If they appear, it's because the address being profiled doesn't match the domain name on the certificate

To profile ASP.NET applications running on IIS:

  1. From the list of application types, click IIS - ASP.NET.
  2. Select the URL for ASP.NET web application for the web application that you want to profile.
    To load a list of currently-running sites from IIS into the dropdown list, click
    Note that the port specified in this URL is the port where the application usually runs under IIS, which is not necessarily the same as the port where the application is to be profiled.
    (This is explained in more detail in step 4).
  3. To set your server options, click Show server options.
    Port and ASP account settings are displayed:
  4. From the server options, choose a port.

    The port you profile on depends on your version of IIS. The profiler automatically detects the version of IIS you are using.
    If you are using IIS 5, ANTS Performance Profiler will profile your application on its original port. This will automatically restart IIS.

    Port selection options are not displayed when profiling with IIS 5.

    If you are using IIS 6 and later, you can choose to profile on the original port or on an unused port:


    • Select Unused port if your application does not bind to a specified port. ANTS Performance Profiler will start a new instance of your application on the specified port, avoiding a restart of IIS. The port where the application will be profiled is displayed at the bottom of the settings screen.

      If you're profiling an HTTPS website, you cannot profile on an unused port.

    • Select Original port if your application's code binds to a specific port. ANTS Performance Profiler will stop your application, attach to it, and restart it on the original port.

  5. Specify which user to run the profiling session as.
    From the server options, select Manually specify ASP.NET account details and enter the User namePassword and (in IIS 6 and 7) Domain.
    • With IIS 5, ANTS Performance Profiler can only run as the ASPNET user. Ensure that this user has permission to read from: %ProgramFiles%\Red Gate\ANTS Performance Profiler 10\ProfilerCore.dll and %ProgramFiles%\Red Gate\ANTS Performance Profiler 10\X64\RedGate.ProfilerCore.dll
      If your Application Host configuration file is set to protect the credentials of the ASPNET user, ANTS Performance Profiler may be unable to detect them. In this case, select Manually specify ASP.NET account details and enter the ASPNET username and password.
    • With IIS 6 and later, ANTS Performance Profiler profiles your web application as the Windows Local System user by default. This is appropriate for most websites. However, if your web application connects to a remote server (such as a database server), the Windows Local System user might not have appropriate permissions to make the remote connection. In this case, enter the credentials of a user who does have the required permissions. Note that the user you specify must be an administrator, and must have permission to read from %ProgramFiles%\Red Gate\ANTS Performance Profiler 10\ProfilerCore.dll and %ProgramFiles%\Red Gate\ANTS Performance Profiler 10\X64\RedGate.ProfilerCore.dll
  6. Select the required Profiling mode, Chart performance counters, and Additional profiler options.
    For more information, see Choosing application types and settings and Setting up chart performance counters.
    Note that SQL queries and incoming HTTP calls will be profiled automatically.
  7. From the browser dropdown, choose a browser launch the application.
  8. Click 
    ANTS Performance Profiler launches the IIS user mode worker process (w3wp.exe), using a cut-down configuration file based on the site's applicationHost.config configuration file. The default broswer then starts and displays your web application.

During a profiling session you can interact normally with your web application and with the profiler.

When you have finished interacting with your web application, click the  button in ANTS Performance Profiler to stop profiling.

Summary:


Closing your browser window will not cause profiling to stop.

See also Profiling an ASP.NET application (worked example).


Profiling WCF services running on IIS

The procedure for profiling Windows Communication Foundation (WCF) services running in IIS is similar to the procedure used to profile other types of web application in IIS. It may help to think of the service as a server in a server-client relationship.

To profile a WCF service:

  • Before you start, change the WCF client contract to communicate on the unused port that you select in ANTS Performance Profiler (by default, 8013).

    Changing the port is necessary because otherwise the client will communicate with the copy of the server hosted in IIS, not the copy in the worker process started by ANTS Performance Profiler.

  • Set the URL for ASP.NET web application to the path to the web application on the server. 
  • Select No browser
  • When you start profiling, Internet Explorer will launch.

    Minimize this window and interact with your client application instead. 

For more information on profiling WCF services, see Profiling WCF applications.

Profiling MVC applications

To profile ASP.NET MVC applications in IIS Express and Web Development Server, browse to the folder for your MVC application.

Troubleshooting

If you encounter problems while trying to profile an application in IIS, see Troubleshooting IIS profiling.


Didn't find what you were looking for?