# 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:

<table><thead><tr><th width="167.6666259765625"></th><th>StockManager</th><th>OnlineShop</th></tr></thead><tbody><tr><td>App Path</td><td><code>C:\inetpub\wwwroot\StockManager</code></td><td><code>C:\inetpub\wwwroot\OnlineShop</code></td></tr><tr><td>IIS App Pool</td><td><code>StockManagerAppPool</code></td><td><code>OnlineShopAppPool</code></td></tr><tr><td>Lab ID</td><td><code>StockManager_EnvQA1</code></td><td><code>OnlineShop_EnvUAT1</code></td></tr><tr><td>BSID File location</td><td><code>C:\inetpub\wwwroot\StockManager\buildSessionId.txt</code></td><td><code>C:\inetpub\wwwroot\OnlineShop\buildSessionId.txt</code></td></tr></tbody></table>

### Configuration

You'll have to use the following setup:

{% stepper %}
{% step %}
**Create the sessions JSON file**

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

```json
{
  "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"
      }
    }
  ]
}
```

{% endstep %}

{% step %}
**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):

{% code overflow="wrap" %}

```
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
```

{% endcode %}

{% hint style="info" %}
Logging is shared across all sessions. You cannot define a separate log directory per application.
{% endhint %}
{% endstep %}

{% step %}
**Configure the rest as usual**

See [Configuring the Profiler-Initiated Collector > Specific configurations > IIS/Windows](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/.net-core-agent/capturing-coverage-from-the-application/configuring-the-profiler-initiated-collector#iis-windows)
{% endstep %}
{% endstepper %}

{% hint style="success" %}
When these steps are complete, new entries will appear in **Cockpit > Live Agents Monitor**: a `testListener` and an entity named `Profiler`, for each entry listed in the session file with each version details and the IIS AppPool shown in the **Tag** column
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/troubleshooting-faq/.net-.netcore/profiling-multiple-products-hosted-on-a-single-iis-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
