Configuration on ASP.NET
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes. The Elastic APM .NET agent enables you to trace the execution of operations in your .NET applications, sending performance metrics and errors to the Elastic APM server. Availability This functionality is generally available and ready for production usage. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless Observability
Generally available
Stack
Generally available
APM Agent .NET
Generally available
When monitoring ASP.NET applications the agent uses two sources of configuration:
- Web.config
<appSettings>section - Environment variables
Web.config takes precedence over environment variables which means that the agent tries first to find a configuration option value by its key in Web.config. If it’s not present, then the agent tries to look for it among environment variables. If it’s not present, the agent falls back to the options default value.
You can find the key of each configuration option in the IConfiguration or Web.config key column of the corresponding option’s description.
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 Elastic.Apm.Config namespace. Once implemented, you can use the FullFrameworkConfigurationReaderType setting.
This setting is .NET Full Framework only.
This setting can point an agent to a custom IConfigurationReader implementation and the agent will read configuration from your IConfigurationReader implementation.
Use type name in AssemblyQualifiedName format (e.g: MyClass, MyNamespace).
| Environment variable name | Web.config key |
|---|---|
ELASTIC_APM_FULL_FRAMEWORK_CONFIGURATION_READER_TYPE |
ElasticApm:FullFrameworkConfigurationReaderType |
| Default | Type |
|---|---|
| None | String |
If this setting is set in both the web.config file and as an environment variable, then the web.config file has precedence.