ANTS Profiler box shot

ANTS Profiler

How to profile ASP.NET applications hosted in the built-in web server

This article explains how you can use ANTS Performance Profiler 4 (APP4) to profile web applications. We'll look at how you profile web applications hosted in the ASP.NET Development Server (also known as WebDev).

The ASP.NET Web Development Server is the built-in web server for your development environment. It's a good place to start debugging the web application you're developing because, unlike in IIS, you don't have to worry about configuration and security settings. You also don't have to worry about stopping and restarting the web server. However, it does have limitations so, eventually, you will want to test your web application under IIS. This is especially true if your web application has pages where only users with the appropriate security settings can access particular pages.

Setting up the Performance Profiler

Before you start profiling you'll need a debug build of your web application. When you start up APP4, you will be greeted with the Performance Profiler Settings dialog.

Setting the profiler

On the Performance Profiler Settings dialog box perform the following steps:

  1. Set the application type to profile to ASP.NET web application (hosted in web development server).
  1. Set the path combo box to point to the path of your application, identified by the file extension .aspx.

    Note: you'll probably find that the .aspx file isn't located in the
    Visual Studio Projects folder as you would normally expect!
    For example, my VS2005 ASP.Net project is located at
    C:\Profiles\ \My Documents\Visual Studio 2005\Projects\WebSite3.

    But my application is located in
    C:\Profiles\ \My Documents\Visual Studio 2005\WebSites\WebSite3
    \Default.aspx
    .

  2. Set the Profiling mode – we will use the default profiling mode.

  3. Set the Default timing display to CPU.
  1. Set the Port to bind web server to – we will use the default port of 8013.

On the Performance Profiler Settings dialog, select the Performance Counters tab.

Performance Counters

Here we can select any additional performance counters that we are interested in. For this scenario, we will monitor the Anonymous Requests/Sec and the Requests/Sec counters located under the ASP.NET group. We will also use the % Processor Time counter, which is selected by default.

Starting the profiler

We have now set all the information needed to start profiling our application. So we can click Start Profiling. At this point, the Web development server will start up, along with our web application in Internet Explorer.

The application being profiled here is a simple ASP.NET web application that consists of a button and a text box.

Simple ASP.NET application

Getting results

During a profiling session you can interact with the profiler whilst your application is still being profiled, and obtain results by selecting areas of the timeline.

Press the Stop Profiling button.

Stop Profiling button

This will close down both the web development server and the ASP.NET application. All the performance profiling data collected for the application will be displayed in the APP4 user interface.

Results screen

Conclusion

This short article is intended to get you going with optimizing the performance of your ASP.NET applications.