APM Agent language and version: apm-agent-dotnet v1.25.3
Kibana version: 7.17.13
Elasticsearch version: 7.17.13
APM Server version: 7.17.13
Browser version: is not applicable
Original install method (e.g. download page, yum, deb, from source, etc.) and version: download page
Fresh install or upgraded from other version?: fresh install
I use APM auto instrumentation for the web application running under IIS 10. It works good when capture requests to MVC controllers. But I have also a bunch of WCF services I want to profile. Since APM agent can not capture WCF method names I use Elastic.Apm.Agent.Tracer.StartTransaction
method to push data to the APM server.
Actually data is pushed to the APM server however I always get the following error in the event viewer when the application is started
.NET Runtime version 4.0.30319.0 - Loading profiler failed during CoCreateInstance. Profiler CLSID: '{FA65FE15-F085-4681-9B20-95E04F6C03CC}'. HRESULT: 0x8007007e. Process ID (decimal): 18408. Message ID: [0x2504].
I don't have any other profilers installed that may cause the conflict. I added a tracelistener as described here and got the follolwing:
[2024-01-24 15:28:15.160 +01:00][86][Error] - {BackendCommComponentBase (CentralConfigurationFetcher)} WorkLoop Current thread: `ElasticApmCentralConfigurationFetcher' (managed ID: 86)+-> Exception: System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Monitor.ObjWait(Boolean exitContext, Int32 millisecondsTimeout, Object obj)
at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.InternalWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Elastic.Apm.BackendComm.CentralConfig.CentralConfigurationFetcher.WorkLoopIteration()
at Elastic.Apm.BackendComm.BackendCommComponentBase.WorkLoop()
[2024-01-24 15:28:15.160 +01:00][80][Error] - {BackendCommComponentBase (PayloadSenderV2)} WorkLoop Current thread: ElasticApmPayloadSenderV2' (managed ID: 80)+-> Exception: System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.Monitor.ObjWait(Boolean exitContext, Int32 millisecondsTimeout, Object obj) at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.InternalWait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.Dataflow.DataflowBlock.Receive[TOutput](ISourceBlock1 source, TimeSpan timeout, CancellationToken cancellationToken)
at Elastic.Apm.Report.PayloadSenderV2.ReceiveBatch()
at Elastic.Apm.Report.PayloadSenderV2.WorkLoopIteration()
at Elastic.Apm.BackendComm.BackendCommComponentBase.WorkLoop()
What actually tells me nothing.
I have another profiled applications running under the same IIS server and they do not produce any errors. Moreover if I run this code on my local windows 11 machine (also IIS 10) I don't get any errors and see captured SQL statements as well what I don't have on the production machine.
There were conflicts connected with System.Diagnostics.DiagnosticSource
library coming somewhere from the EntityFramework.Core 3.14 library referenced from one of the packages the application uses what made me add the binding redirect in the web.config
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
To be onest I'm not sure if this could be the source of the issue so I kindly ask you for assistance to get to the bottom.