Skip to main content
A newer version of this page is available. .

Set Up the Profiler

  • 5 minutes to read

Before actually profiling an application, you need to appropriately configure the profiler, which must know where the application resides and how to connect to it. The configuration process involves specifying proper profiler settings as well as patching the application configuration file. In special cases, you may need to use additional tools or modify the application.

Run XPO Profiler

By default, the XPO Profiler executable (XPOProfiler.exe) is installed to C:\Program Files (x86)\DevExpress 19.1\Components\Tools\Components. You can also invoke it using the DEVEXPRESS | All Platforms | Run XPO Profiler menu command in Visual Studio.

XPOProfiler_Run

Prepare Your Application

First of all you need to customize your application configuration file to specify profiling settings. For this purpose, run the XPO Profiler.

In the XPO Profiler window, invoke the File menu and click Update App.config.

XPOProfiler_PatchConfig

Locate your application configuration file in the displayed dialog, select it and click Open.

XPOProfiler_PatchConfig2

You will be asked whether or not you wish to review and customize the modifications that have been made to the application configuration file. Click Yes.

XPOProfiler_PatchConfig3

This will open the modified application configuration file in your IDE. You will see that the profiler adds two XML elements to the configuration file. One of these elements is DevExpressXpoProfiler. It specifies configuration settings you may need to customize.

<DevExpressXpoProfiler 
  serverType="DevExpress.Xpo.Logger.Transport.LogServer" 
  serverAssembly="DevExpress.Xpo.v19.1, 
  Version=19.1.16.0, 
  Culture=neutral, 
  PublicKeyToken=b88d1754d700e49a" 
  categories="SQL;Session;DataCache" 
  port="52934" />

The element’s categories attribute specifies XPO events categories the profiler will track. There are three categories available.

  • SQL - SQL queries.
  • Session - Session events.
  • DataCache - Data cache events.

The element’s port attribute specifies the number of the port that will be used by the profiler to connect to your application. The default port number is 52934. If this port number is used by another application, specify an unused port number. If you are profiling different applications hosted on the same machine, use different port numbers. Write down the port number you have specified in the configuration file, as you will need to specify it again when connecting the profiler to the application.

Note

  • If you want to see the call stack in XPO Profiler, set the static LogManager.IncludeStackTrace property to true.
  • If you are going to profile a remotely installed application via XPOProfilerProxy, you cannot use the 52927 port number as it is reserved for service communications.

Remotely Installed WinForms/ASP.NET Applications

If you need to profile a remotely installed application, then in addition to patching the application configuration file, you will need to use the XPOProfilerProxy utility. This utility is located in the C:\Program Files (x86)\DevExpress 19.1\Components\Tools\Components\ folder, by default. This utility must be run on the machine where your application is deployed. You can run the utility either as a console application or as a service, with the following command line options.

  • /c - Start as a console application.
  • /i - Install as a service.
  • /u - Uninstall the service.

ASP.NET Applications Running in Medium Trust Environment

To profile an ASP.NET application running in a medium trust environment, you need to deploy a WCF service alongside the application. The profiler will use this service to receive messages from your ASP.NET application. To create the WCF service, right-click your application project in Visual Studio and choose Add > New Item.

XPOProfiler_AddNewItem

Select the WCF Service template, type MyLogService.svc into the Name field and click Add.

XPOProfiler_AddWcfService

The application’s Web.config configuration file will be patched and three files - IMyLogService.cs (IMyLogService.cs), MyLogService.svc, and MyLogService.svc.cs (MyLogService.svc.vb) will be added to the solution. Delete the IMyLogService.cs (IMyLogService.cs) file and modify the MyLogService.svc.cs (MyLogService.svc.vb) file as follows.

using System.ServiceModel;
using DevExpress.Xpo.Logger;
using DevExpress.Xpo.Logger.Transport;
//...
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class MyLogService : LogService {
    static LoggerBase logger = new LoggerBase(50000);
    public MyLogService() : base(logger) { }
    static MyLogService() {
        LogManager.SetTransport(logger);
    }
}

Open the Web.config file and modify the <system.serviceModel> section as follows:

<system.serviceModel>    
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>    
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false"/>
    <services>
      <service name="MyWebApplication.MyLogService">
        <endpoint address="" binding="wsHttpBinding" contract="DevExpress.Xpo.Logger.Transport.ILogSource" />
      </service>
    </services>
</system.serviceModel>

Use the fully qualified name of your service instead of MyWebApplication.MyLogService.

Specify Connection Parameters

Invoke the File menu and click New...

XPOProfiler_New

Choose an appropriate WCF binding type. This field defines transports and protocols to be used by the profiler when interacting with your application. By default, this field is set to NetTcpBinding.

  • NetTcpBinding - Choose this binding type to profile Windows Forms applications or ASP.NET applications running in a full trust environment.
  • WSHttpBinding - Choose this binding type to profile an ASP.NET application running in a medium trust environment.

XPOProfiler_Binding

Specify the name of the server where your application is deployed. By default, this field lists localhost. If you are profiling a locally deployed application, leave localhost as the field value. Otherwise, type in the required server name.

XPOProfiler_ServerName

Provide the port number you have specified when patching your application configuration file. If you are profiling an ASP.NET application running in a medium trust environment, specify the port number used by the server hosting the application. Typical port number used by HTTP servers is 80.

XPOProfiler_Port

If you have specified WSHttpBinding as the binding type, provide the name of the WCF service you deployed along with your application.

XPOProfiler_ServiceName

Click OK. Now that you have set up the profiler, you are ready to profile your application.