.NET An error occurred while sending the request

I am pretty new to APM and i am trying to set it on a .NET 4.6.2 web project. I follow these two documents

when i do configure config file for some project it works and apm shows transactions. But on some projects i get this error. I dont think so this error occurs cause of token. I would appreciate the help.

[2022-02-07 16:25:36.613 +03:00][Error] - {CentralConfigurationFetcher} Exception was thrown while fetching configuration from APM Server and parsing it. ETag: <null>'. URL: https://apm-server.burgan.com.tr/config/v1/agents?service.name=AtmCreditPayment_Clr4IntegratedAppPool'. Apm Server base URL: https://apm-server.burgan.com.tr/'. WaitInterval: 5m. dbgIterationsCount: 1. +-> Request: Method: GET, RequestUri: 'https://apm-server.burgan.com.tr/config/v1/agents?service.name=AtmCreditPayment_Clr4IntegratedAppPool', Version: 1.1, Content: <null>, Headers: { User-Agent: apm-agent-dotnet/1.12.0+9a6d3b0c81bf5341bcc188ef8bbc66cf24af958c User-Agent: (AtmCreditPayment_Clr4IntegratedAppPool) User-Agent: System.Net.Http/4.8.3752.0 User-Agent: .NET_Framework/4.8.4420.0 Authorization: [REDACTED] } +-> Response: N/A +-> Response body [length: N/A]: N/A+-> Exception: System.Net.Http.HttpRequestException: An error occurred while sending the request. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Elastic.Apm.BackendComm.CentralConfig.CentralConfigurationFetcher.<FetchConfigHttpResponseImplAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Elastic.Apm.Helpers.AgentTimerExtensions.<TryAwaitOrTimeout>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Elastic.Apm.Helpers.AgentTimerExtensions.<TryAwaitOrTimeout>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Elastic.Apm.Helpers.AgentTimerExtensions.d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Elastic.Apm.BackendComm.CentralConfig.CentralConfigurationFetcher.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Elastic.Apm.BackendComm.CentralConfig.CentralConfigurationFetcher.d__15.MoveNext()

After a while, i found a document of yours about http request.

in web.config my keys looks like this. Even though i added capturebody as equal all i still get same error. I would appreciate the help.

[2022-02-11 09:56:45.222 +03:00][Error] - {CentralConfigurationFetcher} Exception was thrown while fetching configuration from APM Server and parsing it. ETag: <null>'. URL: https://apm-server.****.com.tr/config/v1/agents?service.name=ATM'. Apm Server base URL: https://apm-server.****.com.tr/'. WaitInterval: 5m. dbgIterationsCount: 1. +-> Request: Method: GET, RequestUri: 'https://apm-server.burgan.com.tr/config/v1/agents?service.name=ATM', Version: 1.1, Content: <null>, Headers: { User-Agent: apm-agent-dotnet/1.14.0+a04553cf41c2bc212d866c6031f087273edb9a8b User-Agent: (ATM) User-Agent: System.Net.Http/4.8.3752.0 User-Agent: .NET_Framework/4.8.4420.0 Authorization: [REDACTED] } +-> Response: N/A +-> Response body [length: N/A]: N/A+-> Exception: System.Net.Http.HttpRequestException: An error occurred while sending the request. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Elastic.Apm.BackendComm.CentralConfig.CentralConfigurationFetcher.<FetchConfigHttpResponseImplAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Elastic.Apm.Helpers.AgentTimerExtensions.<TryAwaitOrTimeout>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Elastic.Apm.Helpers.AgentTimerExtensions.<TryAwaitOrTimeout>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Elastic.Apm.Helpers.AgentTimerExtensions.d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Elastic.Apm.BackendComm.CentralConfig.CentralConfigurationFetcher.d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Elastic.Apm.BackendComm.CentralConfig.CentralConfigurationFetcher.d__15.MoveNext()

This log says that the agent was not able to fetch central config values from Kibana. This means that configuring the agent will only work locally (e.g. from the web.config file as you already do it) and not from the Kibana.

You can look up how to turn on Central config here. Overall if you don't want to use central config, you can ignore this error log.

I understand this log message is super confusing. I opened an issue to consider making this better: CentralConfigurationFetcher error logs change to warning · Issue #1626 · elastic/apm-agent-dotnet · GitHub

@GregKalapos. I checked and we have a kibana end point and have already multiple apps that sends transaction logs to apm.

This error only occurs with soup api apps. So far i have tried two different soap based web apps and got same error log. Twp of them use .NET 4.6.2. I dont know if it has something to do with soap. Do you have any advice, i would really appreciate.

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