In ANTS Performance Profiler, you can profile Windows Communication Foundation (WCF) applications. To do this it can help to think of a WCF application as a server in a server-client relationship, where a client application consumes data from the WCF application, and you collect performance data by interacting with that client.

The method you use to profile WCF applications depends on what you are using to host it.

You can profile WCF services:

Profiling WCF services as .NET executables

If your WCF application is implemented as a .NET executable, the procedure for profiling is the same as the procedure used to profile other .NET executables.

To profile a .NET executable:

  1. From the list of application types, click .NET executable.
  2. Type or browse to the Path to .NET executable that you want to profile.
    You can use the dropdown list to select a recently-profiled application.
  3. If you need to specify any command line arguments for the application, click Show startup options.
    You can add arguments and change the working directory for the profiling session here. The working directory is the path where the application will start. By default, this is the directory where the executable is located.
  4. Select the required Profiling modeChart performance counters,  Additional profiler options, and the browser to launch the application.
    For more information, see Working with application settings and Setting up chart performance counters.

  5. Click 

The .NET executable starts, profiling begins, and your performance counters start to show on the timeline.

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

 

Profiling WCF services hosted in IIS

The procedure for profiling WCF services running in IIS is similar to the procedure used to profile other types of web application in IIS.

To profile a WCF service hosted in IIS, perform the following steps:

  1. 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.

  2. In ANTS Performance Profiler, on the setting screen, from the list of application types, click IIS - ASP.NET.
  3. Set the URL for ASP.NET web application to the path to the the WCF web application on the server.
    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.
  4. To set your server options, click Show server options.
    Port and ASP account settings are displayed:

    From the server options, choose a port.
  5. 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.

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


  7. 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.
  8. Select the required Profiling modeChart performance counters,  Additional profiler options, and the browser to launch the application.
    For more information, see Working with application settings and Setting up chart performance counters.
    Note that SQL queries and incoming HTTP calls will be profiled automatically.
  9. In the browser selection dropdown, choose the browser you want to use if you application has a web interface. Otherwise, ensure No browser is selected.
  10. Click 

Profiling starts. If you have selected a browser but your application does not have a web interface, a browser window will launch. You can ignore this window and interact with your application normally.

Profiling WCF services as Windows services

To profile a WCF application as a Windows service, the procedure for profiling is the same as the procedure used to profile other Windows services.

To profile as a Windows service:

  1. From the list of application types, click Windows service.
  2. Select your .NET Windows Service from the drop down list. 
    Click   to update the list of Windows services.
  3. If you need to specify any command line arguments for the application, click Show startup options.
    The Arguments box is displayed. Type any arguments you want to use here.
  4. Select the required Profiling modeChart performance counters,  Additional profiler options, and the browser to launch the application.
    For more information, see Working with application settings and Setting up chart performance counters.
  5. Click 

If the service is not already started, ANTS Performance Profiler will start the service. If the service is already started, the profiler will restart the service.

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

 

Start interacting with the client program to call the service. The service's communications with the client are included in the results.

Ending a profiling session

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

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

If ANTS Performance Profiler launched a browser when you began profiling, closing the browser window will not cause profiling to stop.