# Connect application dotNet to APM (Cloud)

**URL:** <https://discuss.elastic.co/t/connect-application-dotnet-to-apm-cloud/238705>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [June 25, 2020, 3:07pm UTC](https://discuss.elastic.co/t/connect-application-dotnet-to-apm-cloud/238705 "2020-06-25T15:07:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirtash](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@Kirtash](https://discuss.elastic.co/u/Kirtash)\
**Post date:** [June 25, 2020, 3:07pm UTC](https://discuss.elastic.co/t/connect-application-dotnet-to-apm-cloud/238705/1 "2020-06-25T15:07:33Z")

</div>

Good morning,

I'm using the trial version and i would like connect my .net application to APM. I followed the steps that appears in the documentation but is not running.

I didn't change anything about the configuration of the APM or the indices, and I suppose my config file is correct (the serverUrl and token obviously is different):

```auto
> "ElasticApm": {
> "ServerUrls": "http://aaaaaaaa.westeurope.azure.elastic-cloud.com:8200",
> "TransactionSampleRate": 1.0,
> "SecretToken": "xxxxxx",
> "ServiceName": "Orchestrator_Invoicing_Development"
> }

```

I know that the default port of APM is 8200, but in cloud is the same? Is correct?

When I run the application I have this error:

```auto
fail: Elastic.Apm[0]
      {CentralConfigFetcher} Exception was thrown while fetching configuration from APM Server and parsing it. ETag: `<null>'. URL: `http://aaaaaaaa.westeurope.azure.elastic-cloud.com:8200/config/v1/agents?service.name=Eurofirms_Orchestrator_Invoicing_Development&service.environment=Development'. Apm Server base URL: `http://aaaaaaaa.westeurope.azure.elastic-cloud.com:8200/'. WaitInterval: 5m. dbgIterationsCount: 1.
      +-> Request:
          Method: GET, RequestUri: 'http://aaaaaa.westeurope.azure.elastic-cloud.com:8200/config/v1/agents?service.name=Orchestrator_Invoicing_Development&service.environment=Development', Version: 2.0, Content: <null>, Headers:
          {
            User-Agent: elasticapm-dotnet/1.4.0
            User-Agent: System.Net.Http/4.6.27110.04
            User-Agent: .NET_Core/2.2.0
            Authorization: Bearer xxxxx
          }
      +-> Response: N/A
      +-> Response body [length: N/A]: N/A
System.Net.Http.HttpRequestException: Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder ---> System.Net.Sockets.SocketException: Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Elastic.Apm.BackendComm.CentralConfigFetcher.FetchConfigHttpResponseImplAsync(HttpRequestMessage httpRequest)
   at Elastic.Apm.Helpers.AgentTimerExtensions.TryAwaitOrTimeout(IAgentTimer agentTimer, Task taskToAwait, AgentTimeInstant until, CancellationToken cancellationToken)
   at Elastic.Apm.Helpers.AgentTimerExtensions.TryAwaitOrTimeout[TResult](IAgentTimer agentTimer, Task`1 taskToAwait, AgentTimeInstant until, CancellationToken cancellationToken)
   at Elastic.Apm.Helpers.AgentTimerExtensions.AwaitOrTimeout[TResult](IAgentTimer agentTimer, Task`1 taskToAwait, AgentTimeInstant until, CancellationToken cancellationToken)
   at Elastic.Apm.BackendComm.CentralConfigFetcher.FetchConfigHttpResponseAsync(HttpRequestMessage httpRequest)
   at Elastic.Apm.BackendComm.CentralConfigFetcher.WorkLoopIteration()
warn: Elastic.Apm[0]
      {PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server (http://aaaaaaa.westeurope.azure.elastic-cloud.com:8200/):
    Transaction{Id: 88b95afac1b919e3, TraceId: fb1f5f478be34ec22d7c5daf2ae8e819, ParentId: null, Name: GET /API, Type: request, IsSampled: True},
          Transaction{Id: de63d2fecff6a2c6, TraceId: 905ce611e8ffed2eacbd6ba0bcea76ae, ParentId: null, Name: GET /API/index.html, Type: request, IsSampled: True},
          Transaction{Id: d15490ca43286fd8, TraceId: 8a53547a1097eada272f97ab17a46f64, ParentId: null, Name: GET /swagger/v1/swagger.json, Type: request, IsSampled: True}
System.Net.Http.HttpRequestException: Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder ---> System.Net.Sockets.SocketException: Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)

```

Thanks for the help.

---

<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:** [June 25, 2020, 9:08pm UTC](https://discuss.elastic.co/t/connect-application-dotnet-to-apm-cloud/238705/2 "2020-06-25T21:08:25Z")

</div>

Hi @Kirtash,

> I know that the default port of APM is 8200, but in cloud is the same? Is correct?

On cloud it's the default https port, so in that case it is not 8220. Basically no port needs to be specified in case the server runs on cloud.

There is a button for this - you can click that and past the url - with that it should work:

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

The other thing I noticed you use `http` instead of `https` - that should be `https`, like this (with adapting the beginning similarly as you pasted):

```auto
"ServerUrls": "https://aaaaaaaa.westeurope.azure.elastic-cloud.com",

```

_so added `https` and removed the port._

---

<div class="post-metadata">

**Author:** ![Kirtash](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@Kirtash](https://discuss.elastic.co/u/Kirtash)\
**Post date:** [June 26, 2020, 6:38am UTC](https://discuss.elastic.co/t/connect-application-dotnet-to-apm-cloud/238705/3 "2020-06-26T06:38:51Z")

</div>

Thanks Greg!!!! Your answer was perfect 😉

---

<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:** [July 17, 2020, 2:38am UTC](https://discuss.elastic.co/t/connect-application-dotnet-to-apm-cloud/238705/4 "2020-07-17T02:38:53Z")

</div>

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