# Dotnet apm agent samples transactions locally but not when running on Azure App Service

**URL:** <https://discuss.elastic.co/t/dotnet-apm-agent-samples-transactions-locally-but-not-when-running-on-azure-app-service/335948>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [June 14, 2023, 8:29am UTC](https://discuss.elastic.co/t/dotnet-apm-agent-samples-transactions-locally-but-not-when-running-on-azure-app-service/335948 "2023-06-14T08:29:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpoiesz](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@tpoiesz](https://discuss.elastic.co/u/tpoiesz)\
**Post date:** [June 14, 2023, 8:29am UTC](https://discuss.elastic.co/t/dotnet-apm-agent-samples-transactions-locally-but-not-when-running-on-azure-app-service/335948/1 "2023-06-14T08:29:39Z")

</div>

**Kibana version** : 8.7.1

**Elasticsearch version** : 8.7.1 (Elastic Cloud)

**APM Server version** : 8.7.1

**APM Agent language and version** : Elastic APM dotnet Agent, v1.22.0

**.Net Runtime** : 6.0.16

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: Nuget

**Fresh install or upgraded from other version?** Upgraded from v1.17.0 (but downgrading does not fix the issue)

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

The APM agent for our Asp .Net Core application running on Azure App Service is not sampling transactions, so they are never sent to the APM server. It is successfully connecting to the server and sending metrics and errors correctly. When I run my application locally with the same configuration (same endpoint, same secret key) it will create transactions and send them to the APM server.

The following is logged by the middleware when a request is made:

```auto
2023-06-14T08:13:23.687262153Z [08:13:23 DBG] {ApmMiddleware} Incoming request with traceparent header. DistributedTracingData: DistributedTracingData{TraceId: c07b999234c2c9a3c5281f988cd8bf94, ParentId: 5639b18307fd76a3, FlagRecorded: False, TraceState: null}. Continuing trace.
2023-06-14T08:13:23.697050620Z [08:13:23 VRB] {Transaction} New Transaction instance created: Transaction{Id: 3f1542cf63709475, TraceId: c07b999234c2c9a3c5281f988cd8bf94, ParentId: 5639b18307fd76a3, Name: GET ***, Type: request, Outcome: Unknown, IsSampled: False}. IsSampled (False) and SampleRate (null) is based on incoming distributed tracing data (DistributedTracingData{TraceId: c07b999234c2c9a3c5281f988cd8bf94, ParentId: 5639b18307fd76a3, FlagRecorded: False, TraceState: null}). Start time: 2023-06-14 08:13:23.6869970 UTC (as timestamp: 1686730403686997)

```

It seems to me it decides not to sample it 'based on incoming distributed tracing data' but I have no idea what that means.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 12, 2023, 8:29am UTC](https://discuss.elastic.co/t/dotnet-apm-agent-samples-transactions-locally-but-not-when-running-on-azure-app-service/335948/2 "2023-07-12T08:29:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [July 17, 2023, 9:56am UTC](https://discuss.elastic.co/t/dotnet-apm-agent-samples-transactions-locally-but-not-when-running-on-azure-app-service/335948/3 "2023-07-17T09:56:46Z")

</div>

This config would solve this issue: [HTTP configuration options | APM .NET Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-http.html#config-trace-continuation-strategy)

Here (under `Note`) there is more explanation on how this can happen: [HTTP configuration options | APM .NET Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-http.html#config-trace-context-ignore-sampled-false).
