Cannot make APM Client work on IIS

I've tried the Elastic APM with Java applications under Tomcat and worked like a charm. Now, i'm trying to monitor a .NET (4) application running on IIS7.
The documentation is very vague on how to get the agent running. Just a couple of examples adding calls on the source code.
In my case, i don't have access to the source code, just to the server and the application. It's possible to implement application monitoring without modifying the source code?

If the answer is Yes, this is what i've done so far:

  • Installed nuget cli on the server.

  • Downloaded the packages (Elastic.Apm.AspNetFullFramework)

  • I've got all this packages:
    Elastic.Apm.1.2.0
    Elastic.Apm.AspNetFullFramework.1.2.0
    Newtonsoft.Json.11.0.2
    System.Diagnostics.DiagnosticSource.4.0.0
    System.Threading.Tasks.Dataflow.4.9.0

  • Moved all dlls (version 4.0 or 4.5) to wwwroot/app/bin

  • Modified web.config to load dll and set APM server dns:
    ...
    <modules>
    <add name="ElasticApmModule" type="Elastic.Apm.AspNetFullFramework.ElasticApmModule" />

    ...
    <add key="ElasticApm:ServerUrls" value="http://apmserver:8200" />
    ...

  • Restarted Site.

Result:

Error 500

ConfigurationErrorsException
Cannot load type 'Elastic.Apm.AspNetFullFramework.ElasticApmModule'. on System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase)

Any thoughts?

Thanks.

Kibana version: 7.4
Elasticsearch version: 7.4
APM Server version: 7.4
APM Agent language and version: .NET Elastic.Apm.AspNetFullFramework 1.2.0
Original install method (e.g. download page, yum, deb, from source, etc.) and version: NuGet

Hi @JValenzani - welcome to the forum!

Judging by the error it seems to me that IIS doesn't know which DLL actually contains ElasticApmModule class. The way to fix it is to include the name of the assembly in which this type resides, which is Elastic.Apm.AspNetFullFramework

 type="Elastic.Apm.AspNetFullFramework.ElasticApmModule, Elastic.Apm.AspNetFullFramework" />

The configuration described in the documentation, that you used as well, seems to work for AspNetFullFrameworkSampleApp sample application because Elastic.Apm.AspNetFullFramework assembly is one of the explicit AspNetFullFrameworkSampleApp's dependencies and loaded automatically with the application so IIS finds ElasticApmModule without any problem. We need to fix that part of the documentation.

1 Like

Hi Sergey, thanks for the quick answer. Adding the type "Elastic.Apm.AspNetFullFramework" fixed the problem.
I'm not getting data in the server, but probably is something missing in the agent config.

Thank you!

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