# .NET An error occurred while sending the request

**URL:** <https://discuss.elastic.co/t/net-an-error-occurred-while-sending-the-request/296473>\
**Category:** APM\
**Tags:** dotnet, language-clients\
**Created:** [February 7, 2022, 1:34pm UTC](https://discuss.elastic.co/t/net-an-error-occurred-while-sending-the-request/296473 "2022-02-07T13:34:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pancar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pancar/32/101469_2.png) [@pancar](https://discuss.elastic.co/u/pancar)\
**Post date:** [February 7, 2022, 1:34pm UTC](https://discuss.elastic.co/t/net-an-error-occurred-while-sending-the-request/296473/1 "2022-02-07T13:34:34Z")

</div>

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

> **[ASP.NET | APM .NET Agent Reference \[1.12\] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup-asp-dot-net.html)**

> **[Configuration on ASP.NET | APM .NET Agent Reference \[1.12\] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/configuration-on-asp-net.html)**

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](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__1`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.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()

---

<div class="post-metadata">

**Author:** ![pancar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pancar/32/101469_2.png) [@pancar](https://discuss.elastic.co/u/pancar)\
**Post date:** [February 11, 2022, 7:01am UTC](https://discuss.elastic.co/t/net-an-error-occurred-while-sending-the-request/296473/2 "2022-02-11T07:01:34Z")

</div>

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

> **[HTTP configuration options | APM .NET Agent Reference \[1.12\] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/config-http.html#config-capture-body)**

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.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/c/bca6a0ea29b621054b16d94f6dbf87013ba0244b.png)

[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](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__1`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.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()

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [February 11, 2022, 11:53am UTC](https://discuss.elastic.co/t/net-an-error-occurred-while-sending-the-request/296473/3 "2022-02-11T11:53:59Z")

</div>

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](https://www.elastic.co/guide/en/apm/guide/8.0/setup-kibana-endpoint.html). 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](https://github.com/elastic/apm-agent-dotnet/issues/1626)

---

<div class="post-metadata">

**Author:** ![pancar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pancar/32/101469_2.png) [@pancar](https://discuss.elastic.co/u/pancar)\
**Post date:** [March 3, 2022, 7:36am UTC](https://discuss.elastic.co/t/net-an-error-occurred-while-sending-the-request/296473/4 "2022-03-03T07:36:27Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/7/0786c96ce4d2076b26276dddd4909466fb64adf8.png)

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 24, 2022, 3:36am UTC](https://discuss.elastic.co/t/net-an-error-occurred-while-sending-the-request/296473/5 "2022-03-24T03:36:28Z")

</div>

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