When monitoring ASP.NET applications the agent uses two source of configuration: Web.config and environment variables. Web.config has precedence over environment variables which means that the agent first tries to find a configuration option value by its key in Web.config. Only if it’s not present then the agent tries to look for it among environment variables and if it’s not present there as well the agent falls back on the option’s default value.
You can find the key of each configuration option
IConfiguration or Web.config key column of the corresponding option’s description.
Sample configuration fileedit
Below is a sample
Web.config configuration file for a ASP.NET application.
<?xml version="1.0" encoding="utf-8"?> <!-- ... --> <configuration> <!-- ... --> <appSettings> <!-- ... --> <add key="ElasticApm:ServerUrl" value="https://my-apm-server:8200" /> <add key="ElasticApm:SecretToken" value="apm-server-secret-token" /> <!-- ... --> </appSettings> <!-- ... --> </configuration>
Additionally, on ASP.NET, you can implement your own configuration reader. To do this, implement the
IConfigurationReader interface from the
Once implemented, you can make use of the
This setting is .NET Full Framework only.
With this setting you can point an agent to a custom
IConfigurationReader implementation and the agent will read configuration from your
Use type name in AssemblyQualifiedName format (e.g:
|Environment variable name||Web.config key|
If this setting is set in both the web.config file and as an environment variable, then the web.config file has precedence.