Elastic APM Agent asp.net startup hooks dll

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

TIP 1: select at least one tag that further categorizes your topic. For example server for APM Server related questions, java for questions regarding the Elastic APM Java agent, or ui for questions about the APM App within Kibana.

TIP 2: Check out the troubleshooting guide first. Not only will it help you to resolve common problems faster but it also explains in more detail which information we need before we can properly help you.

Kibana version: 7.12.1

Elasticsearch version: 7.12.1

APM Server version: 7.15

APM Agent language and version: 1.11.1 .Net

Browser version:

Original install method (e.g. download page, yum, deb, from source, etc.) and version: releases page elastic.co

Fresh install or upgraded from other version? Fresh

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.
The application is managed with IIS setting the DOTNET_STARTUP_HOOKS variable will not start the agent.
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
IIS will not keep or use the environment variable/s when set. I do not know if I am setting the variables correctly or I am not exposing correctly. I am new to setting up Elastic APM Agents and their components.

Steps to reproduce:

  1. Having a deployed application on an IIS server 2012
  2. set DOTNET_STARTUP_HOOKS pointing to \ElasticApmAgentStartupHook.dll
  3. Restart the IIS application

Errors in browser console (if relevant): Not relevant

Provide logs and/or server output (if relevant):
Unable to setup logging for apm agent.

Hi @ryphilli,

The 1. environment variable seems ok, but the 2. and the 3. don't. They should be ELASTIC_APM_SERVER_URLS and ELASTIC_APM_VERIFY_SERVER_CERT. Here is the list of the configs - if you click on those, you'll see the environment variable for each.

So I guess the agent ignored the server url which you configured - question is if it works once you fix the environment variable. If it doesn't here you find more info on how to troubleshoot the startup hook logic.

@GregKalapos thank you for the reply.
I am wondering where I should be putting these startup hooks environment variables should I be putting them at the topmost position like the server or should it be in the application that I want to monitor that is something that the documentation does not cover. As of now I went to the website level and nothing seems to be happening I even set the elastic_apm_startup_hooks_logging to 1 and the logfile is not being created. So I am not 100% sure I am placing the environment variables in the correct places.

I think I have them in the right place and still I am getting no logging even though I have the variable set or any indication that it started up.

@ryphilli what .NET version are you targeting e.g. netcoreapp3.1 ?

@forloop I am targeting 4.0 according to IIS, but the application I am targeting does not have a version number associated with it. I am assuming that it is also 4.0 to go along with the other applications deployed.

@ryphilli This startup hook feature is only supported on .NET Core 3.0 and newer versions (.NET 5+).

On .NET Full framework (including version 4) this is not supported. Just for completeness: .NET FullFramework (with version 4.x) predates .NET Core 3 - super confusing versioning :slight_smile:

@GregKalapos ,

Thank you for that I was struggling to get it working and now I know that the zero code change route will not work for this implementation. So I will have to go the code change option unless that option also will not work with our environment. But reading through the documentation it should work if I can do the standard setup, but please correct me if I am wrong. I do not want to attempt to change the code if the agent will not work with our version that we are using. Once again thank you for clarifying why it was not working.


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