SeaLights .NET Core agent - Setting up IIS Listener

Coverage Collector IIS Installation

As an Administrator, install and start the coverage collector service: 

SL.DotNet.CoverageCollectorService.exe install --start

Register our agent as a profiler in the IIS services (two specific services - WAS and W3SVC):

SL.DotNet.exe instrumentIIS --force

Perform IIS reset:

iisreset /restart

At the successful completion of this step, you will see a new entry appearing in the Cockpit > Agent Monitor for an entity called CollectorService for dotnet technology

This installation step is updating the following keys in the Windows Registry

  • System\CurrentControlSet\Services\W3SVC

  • System\CurrentControlSet\Services\WAS

Those keys are updated with a Multi-String value called 'Environment' containing the following

In case of testing is executed from within a PowerShell script, the provided environment variables need to be defined using the Set-Item command to be accessible by the PowerShell-spawned processes.

Capturing coverage

During the time you want to run your tests and capture coverage, you can now start and stop the coverage collection of the SeaLights agent test listener

Starting coverage collection session

Before you start running your tests, you need to update the SeaLights Test Listener to start collecting coverage. You do so with the startCollectorServiceSession command.

Since there could be multiple applications running on a single IIS server, it is important to make note of the Application Pool name that corresponds to the hosted application from which coverage will be collected. If you are unsure what your application pool name is for the processTag parameter, refer to the expandable paragraph below (inside this article section) to identify it manually from your IIS Manager console.

For .NET Core processes, set --processName dotnet, as this is the name of the process on which .NET Core applications run.

At the successful completion of this step, you will see additional new entries appearing in the Cockpit > Agent Monitor: the CollectorServiceSession and a entity Profiler.
The Profiler will be highlighting the Application Pool it is connected to as a Tag in the dedicated column.

To retrieve the Application Pool name:

  1. Open the IIS Manager:

    • Either browse to Control Panel → Administrative Tools → Internet Information Services (IIS) Manager

    • Open a new Run prompt (⊞ Win+R) and type inetmgr

  2. On the left side Pane, browse to your IIS instance.

  3. Select "Application Pools" to see a list of all currently configured application pools.

    • The name displayed here corresponds to the Application Pool name you will need to configure in later steps:

  4. Alternatively, on the same pane you can browse to the Site under which your application is hosted, Right click on the application, and select "Advanced Settings":

  5. In the popup window, the first line - Application Pool, corresponds to the name of the application pool to be used:

Running your tests

Now you can run any one of your tests that run against this IIS instance and capture coverage (Don’t forget to send a start and end command with the test stage name):

Stopping coverage collection session

Note: This command can be run on a remote machine (like the CI running the tests) while providing the host to start the session on it, using the parameter: --machine <IIS host> 

Un-installing the Coverage Collector Service

Sometimes when upgrading your agent version, you will need to uninstall the coverage collector service from your machine.

This can be done by running the following command:

Sample script