How to Profile Windows Services
  • Updated on 01 Nov 2018
  • 2 minutes to read
  • Contributors
  • Print
  • Share
  • Dark

How to Profile Windows Services

  • Print
  • Share
  • Dark

By default Retrace only profiles applications hosted within IIS. If you want Retrace to capture transactions from an application running as a Windows service, please follow these directions.

Retrace also supports for the following types of background services. Please review their installation guides for more details.

Step 1. Install Retrace Windows Agent with the option for Windows Services with one of the below options:

Option 1. New install in interactive mode:

Upon installing check the box for Enabling the Retrace for .NET Core and Windows Services.

Option 2. New install via command line, for example:


Replacing the [tokens] as necessary.

Note: set RestartIIS=1 if you wish to have Retrace automatically restart IIS to begin profiling of web apps.

Option 3. For an existing install of Stackify

  •    Modify \[Install Drive\]:Program Files (x86)\\Stackify\\Stackify.ini
  •    Add **AttachAll=1** to the \[FEATURES\] section
  •    Restart the “Stackify Monitoring Service” Windows Service

Step 2. Tell Retrace which services to profile with one of the below options

Option 1.  By using the “/EnableStackify” switch For an existing service, double check what the existing path is via the UI or by the command line “sc query” commands. Copy this path so you can use it via command line to update it.

You can then update the path via command line and add our command line switch to it like so:

CMD> sc config “My Service” binPath=”c:pathapp.exe /EnableStackify”

When you create your service, you may also provide this switch with the executable. For example, to install your service from a command prompt:

Option 2.  By creating a “ProfileProcess.txt” file

This is a JSON formatted file that can define one or many EXEs to profile


You may save this file:

  • In the same folder as the .exe that is being profiled. This would allow you to easily “bin deploy” the file with your app.
  • Into [Install Drive]:Program Files (x86)\Stackify

Step 3. Restart your service

Step 4. Define a transaction for Retrace

At this point, Retrace will begin profiling your code, and capture some data such as exceptions and errors, but to track a transaction through the app, you must add some instrumentation to your app via our library. Depending on the type of application, there are multiple ways to do this.  To learn more and see examples, please see:  Defining Custom Transactions

Was this article helpful?