Profiling Multiple Products Hosted on a Single IIS Server

Problem

When hosting multiple products on a single IIS server, how can you configure dedicated Sealights environment variables (SL_LABID, SL_BUILDSESSIONFILE) for each product, given that IIS (WAS/W3SVC) registry entries are shared across all applications?

Solution

Use the SL_COVERAGECOLLECTOR_PREDEFINEDSESSIONS variable to define a preconfigured sessions file that maps each product to its specific Sealights parameters based on the application pool.

Example Setup

Let's say your IIS server runs two apps:

StockManager
OnlineShop

App Path

C:\inetpub\wwwroot\StockManager

C:\inetpub\wwwroot\OnlineShop

IIS App Pool

StockManagerAppPool

OnlineShopAppPool

Lab ID

StockManager_EnvQA1

OnlineShop_EnvUAT1

BSID File location

C:\inetpub\wwwroot\StockManager\buildSessionId.txt

C:\inetpub\wwwroot\OnlineShop\buildSessionId.txt

Configuration

You'll have to use the following setup:

1

Create the sessions JSON file

Create a collector-sessions.json file with the below content :

{
  "sessions": [
    {
      "session": {
        "buildSessionId": "C:\\inetpub\\wwwroot\\StockManager\\buildSessionId.txt",
        "labId": "StockManager_EnvQA1"
      },
      "coverageCollector": {
        "applicationPool": "StockManagerAppPool"
      }
    },
    {
      "session": {
        "buildSessionId": "C:\\inetpub\\wwwroot\\OnlineShop\\buildSessionId.txt",
        "labId": "OnlineShop_EnvUAT1"
      },
      "coverageCollector": {
        "applicationPool": "OnlineShopAppPool"
      }
    }
  ]
}
2

Refer to this file in the IIS Env Vars

Assuming your current installation path is in the C:\Sealights directory (update the below according to your environment):

COR_ENABLE_PROFILING=1
COR_PROFILER={01CA2C22-DC03-4FF5-8350-59E32A3536BA}
COR_PROFILER_PATH=C:\Sealights\Agent\SL.DotNet.ProfilerLib.Windows_x64.dll
COR_PROFILER_PATH_32=C:\Sealights\Agent\SL.DotNet.ProfilerLib.Windows_x86.dll
COR_PROFILER_PATH_64=C:\Sealights\Agent\SL.DotNet.ProfilerLib.Windows_x64.dll
CORECLR_ENABLE_PROFILING=1
CORECLR_PROFILER={01CA2C22-DC03-4FF5-8350-59E32A3536BA}
CORECLR_PROFILER_PATH_32=C:\Sealights\Agent\SL.DotNet.ProfilerLib.Windows_x86.dll
CORECLR_PROFILER_PATH_64=C:\Sealights\Agent\SL.DotNet.ProfilerLib.Windows_x64.dll
SL_PROFILER_INITIALIZECOLLECTOR=1
SL_TOKENFILE=C:\Sealights\sltoken.txt
SL_COVERAGECOLLECTOR_PREDEFINEDSESSIONS=C:\Sealights\collector-sessions.json
SL_LOGLEVEL=Debug
SL_LOGGING_TOFILE=true
SL_LOGDIR=C:\Sealights\Logs

Logging is shared across all sessions. You cannot define a separate log directory per application.

Last updated

Was this helpful?