# .NET Core (Linux) and JavaScript agent injection

**URL:** <https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733>\
**Category:** Real User Monitoring\
**Tags:** linux, real-user-monitoring-classic, dotnet, kubernetes, javascript\
**Created:** [December 12, 2019, 6:11pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733 "2019-12-12T18:11:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmichels](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@gmichels](https://community.dynatrace.com/u/gmichels)\
**Post date:** [December 12, 2019, 6:11pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/1 "2019-12-12T18:11:57Z")

</div>

Hello everyone,

I have a .NET Core application running in a Linux container in a Kubernetes cluster. I’ve got the Dynatrace Operator deployed and instrumentation for the application using OneAgent works just fine. My problem is the JavaScript agent is not being loaded, and I would like to understand the reason.

The documentation in [Configure automatic injection in RUM Classic — Dynatrace Docs](https://www.dynatrace.com/support/help/how-to-use-dynatrace/real-user-monitoring/basic-concepts/rum-javascript-injection/) states:

> OneAgent JavaScript tag injection is performed automatically during installation for Java, Apache HTTP Server, IIS, NGINX, and Node.js.

Since the .NET Core application is in a Linux container, it’s using Kestrel as the webserver, so I am unsure if that’s the reason it’s not being automatically injected.

Can anyone confirm if auto-injection for the JavaScript agent is supposed to work on .NET Core in Linux?

Thank you

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [December 12, 2019, 6:47pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/2 "2019-12-12T18:47:35Z")

</div>

You didn’t have any webserver that works as reverse proxy that is in front of kestrel? To be honest I’ve never tested auto injection in kestrel itself, I’ve always had nginx or IIS before 🙂 But it may be as you’ve said that auto-injection (at least for now) will not work here.

Sebastian

---

<div class="post-metadata">

**Author:** ![gmichels](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@gmichels](https://community.dynatrace.com/u/gmichels)\
**Post date:** [December 12, 2019, 8:11pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/3 "2019-12-12T20:11:01Z")

</div>

In this case the traffic flows through 2 reverse proxies (first an F5 and then nginx as the ingress controller for Kubernetes), but they are external to the container. Nothing other than Kestrel in the application container for the agent to hook into.

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [December 12, 2019, 10:24pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/4 "2019-12-12T22:24:33Z")

</div>

Install OneAgent on Nginx, it should work without any problem, trust me 🙂

---

<div class="post-metadata">

**Author:** ![gmichels](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@gmichels](https://community.dynatrace.com/u/gmichels)\
**Post date:** [December 12, 2019, 11:27pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/5 "2019-12-12T23:27:05Z")

</div>

Unfortunately auto-instrumentation for the nginx container doesn’t work, I get this in the progress group screen in Dynatrace:

> Activation of deep monitoring was unsuccessful

> Monitoring of statically linked Go programs that do not load libc is not supported

Any other ideas?

Thanks

---

<div class="post-metadata">

**Author:** ![gmichels](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@gmichels](https://community.dynatrace.com/u/gmichels)\
**Post date:** [December 13, 2019, 2:54am UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/6 "2019-12-13T02:54:01Z")

</div>

I noticed I had selected the wrong process group for the previous reply regarding nginx, and now I got the correct one which shows up as being instrumented in the Dynatrace UI (nginx ingress controller pod needed a bounce), however I still see no auto-injection happening for the .NET Core application.

So unfortunately it didn’t work even with OneAgent on nginx 😞

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [December 13, 2019, 6:52am UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/7 "2019-12-13T06:52:37Z")

</div>

If you are sure that you are connecting to .net core web application via nginx it has to work. This is because Ngon is serving HTML content generated by .net core. Agent than should detect multiple domains (if it’s reverse proxy for more than one application) and RUM should work.

It can be different issue, did you try to go to default application? If you don’t have rum configured at all you should see there information about potential reasons why RUM wasn’t injected.

Sebastian

---

<div class="post-metadata">

**Author:** ![gmichels](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@gmichels](https://community.dynatrace.com/u/gmichels)\
**Post date:** [December 13, 2019, 4:43pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/8 "2019-12-13T16:43:43Z")

</div>

Unfortunately it still not working, I don’t see any requests in the browser’s developer tools for the javascript agent.

I am sure both nginx (in blue) and the .net core application (in red) are being instrumented, see purepath and service backtrace from the .net core application:

 ![22911-1576255070048.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/4/64833756554f44257a49bfa844c87a5460a046a5.png)

 ![22912-1576255089955.png](https://global.discourse-cdn.com/dynatrace/original/2X/8/8028583f584090be804ee8c3603c4ed27edcfce9.png)

My application detection setup is correct, there is a rule pointing to the FQDN being used by the nginx service (the blue part below matches the blue part above):

 ![22913-1576255262506.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a17d78aca2f4964ab39e4e49d054fc1c0bf3c68b.png)

Thank you

---

<div class="post-metadata">

**Author:** ![gmichels](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@gmichels](https://community.dynatrace.com/u/gmichels)\
**Post date:** [January 8, 2020, 7:01pm UTC](https://community.dynatrace.com/t/net-core-linux-and-javascript-agent-injection/22733/9 "2020-01-08T19:01:05Z")

</div>

To close the loop here, my problem was compression was enabled between nginx and kestrel, and auto-injection will not work when there is compression.

I was able to fix it by disabling compression via this ingress annotation:

```auto
nginx.ingress.kubernetes.io/configuration-snippet: |
      proxy_set_header Accept-Encoding identity;

```

Injection worked just fine after the ingress was updated.

Thanks
