# Disable .net agent

**URL:** <https://discuss.elastic.co/t/disable-net-agent/254597>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [November 7, 2020, 6:19am UTC](https://discuss.elastic.co/t/disable-net-agent/254597 "2020-11-07T06:19:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![radudami](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@radudami](https://discuss.elastic.co/u/radudami)\
**Post date:** [November 7, 2020, 6:19am UTC](https://discuss.elastic.co/t/disable-net-agent/254597/1 "2020-11-07T06:19:28Z")

</div>

We want to implement Elastic APM only for some environments so we need a method to disable the agent.  
For dotnet core it's pretty straight-forward since you can skip calling `app.UseAllElasticApm(Configuration)`, but for .NET Framework 4.8 windows services I couldn't find a way to disable it, since for every `Elastic.Apm.Agent.Tracer.StartTransaction()` it tries to connect to Elastic APM.

Does anybody have an idea on how this can be done?

Thanks,  
Radu

---

<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:** [November 7, 2020, 12:00pm UTC](https://discuss.elastic.co/t/disable-net-agent/254597/2 "2020-11-07T12:00:42Z")

</div>

Hi @radudami,

right now there isn't a really good way to do it, but I'm actively working on an issue that would solve this.

[Here](https://github.com/elastic/apm-agent-dotnet/issues/122#issuecomment-717549136) is the plan on how this would work and [this](https://github.com/elastic/apm-agent-dotnet/pull/997) is the in-progress PR that implements it.

No promises, but the intention is that this will be in included in the next release.

---

<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:** [November 28, 2020, 8:00am UTC](https://discuss.elastic.co/t/disable-net-agent/254597/3 "2020-11-28T08:00:44Z")

</div>

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