# How to integrate APM with windows services .NET

**URL:** <https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659>\
**Category:** APM\
**Tags:** dotnet, language-clients\
**Created:** [May 13, 2022, 9:39am UTC](https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659 "2022-05-13T09:39:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wajihrehman](https://avatars.discourse-cdn.com/v4/letter/w/c57346/32.png) [@wajihrehman](https://discuss.elastic.co/u/wajihrehman)\
**Post date:** [May 13, 2022, 9:39am UTC](https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659/1 "2022-05-13T09:39:12Z")

</div>

Hi @GregKalapos any idea how to integrate APM in windows services .NET and check logs if it working fine or not.

---

<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:** [May 18, 2022, 11:07pm UTC](https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659/2 "2022-05-18T23:07:50Z")

</div>

Hi @wajihrehman,

you'll need the Public Agent API to start the trace manually, docs [here](https://www.elastic.co/guide/en/apm/agent/dotnet/current/public-api.html).

Regarding checking agent logs: The agent has a public logging interface and you can pass your own logger to it. This is documented [here](https://www.elastic.co/guide/en/apm/agent/dotnet/current/troubleshooting.html#collect-logs-class-other-logging-systems) - with that you can e.g. pass a small logger to the agent which logs everything into a file.

---

<div class="post-metadata">

**Author:** ![wajihrehman](https://avatars.discourse-cdn.com/v4/letter/w/c57346/32.png) [@wajihrehman](https://discuss.elastic.co/u/wajihrehman)\
**Post date:** [May 19, 2022, 7:14am UTC](https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659/3 "2022-05-19T07:14:42Z")

</div>

So, in short steps to integrate APM into windows services need to follow following steps.

1. install NuGet packages. elasticaspfullframework.
2. Set environment variables through PowerShell.
3. Use the Public API  
am i right or need to add anything else in app.config.

---

<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:** [May 19, 2022, 9:31am UTC](https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659/4 "2022-05-19T09:31:21Z")

</div>

That's correct, only important thing I'd add is that in point 1. you need to install [NuGet Gallery | Elastic.Apm 1.15.0](https://www.nuget.org/packages/Elastic.Apm/) and not the elasticaspfullframework package.

No need to change stuff in app.config. By default the agent will read configs (like server url, which you may need to set) from environment variables. Environment variable names for specific configs can be found in the docs, e.g.: [Reporter configuration options | APM .NET Agent Reference [1.12] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-reporter.html#config-server-url)

With that you should be good to go.

---

<div class="post-metadata">

**Author:** ![wajihrehman](https://avatars.discourse-cdn.com/v4/letter/w/c57346/32.png) [@wajihrehman](https://discuss.elastic.co/u/wajihrehman)\
**Post date:** [May 19, 2022, 9:45am UTC](https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659/5 "2022-05-19T09:45:49Z")

</div>

Thank you so much really appreciated always get a response from you.

---

<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:** [June 9, 2022, 5:45am UTC](https://discuss.elastic.co/t/how-to-integrate-apm-with-windows-services-net/304659/6 "2022-06-09T05:45:51Z")

</div>

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