Advanced configuration for IIS applications 🔗
Follow these advanced configuration steps to make changes to specific application pools.
Set environment variables 🔗
You can set environment variables for specific application pools in the environmentVariables
block of the applicationHost.config file .
例:
<environmentVariables>
<add name="OTEL_RESOURCE_ATTRIBUTES" value="deployment.environment=test,service.version=1.0.0" />
</environmentVariables>
For all IIS applications, consider setting common environment variables for W3SVC and WAS Windows Services. For more information, see Instrument a Windows Service running a .NET application in the OpenTelemetry documentation.
注釈
If the same environment variables are set in the environmentVariable
block and in the web.config appSettings
block, the value in the environmentVariables
block takes precedence.
Activate or deactivate instrumentation 🔗
For .NET Framework applications, use the PowerShell module to activate or deactivate the instrumentation for specific application pools.
Import the PowerShell module:
Import-Module "OpenTelemetry.DotNet.Auto.psm1"
注釈
The application pool name is case sensitive.
Activate or deactivate the application pool.
Activate instrumentation for the application pool:
Enable-OpenTelemetryForIISAppPool -AppPoolName <app-pool>
Deactivate instrumentation for the application pool:
Disable-OpenTelemetryForIISAppPool -AppPoolName <app-pool>
Restart the application pool:
Restart-WebAppPool -Name <app-pool>