# {PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server

**URL:** <https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [April 6, 2021, 5:02pm UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363 "2021-04-06T17:02:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rolfen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rolfen/32/86634_2.png) [@Rolfen](https://discuss.elastic.co/u/Rolfen)\
**Post date:** [April 6, 2021, 5:02pm UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/1 "2021-04-06T17:02:00Z")

</div>

**Kibana version** : None

**Elasticsearch version** : None

**APM Server version** : 7.10.1 (amd64), libbeat 7.10.1 [b7c209e80c4674603447458e62963ed5246b5297 built 2020-12-04 22:07:34 +0000 UTC]

**APM Agent language and version** : .Net Core with Elastic.Apm.NetCoreAll from 1.7.0 to 1.9.0 (upgraded because it also wasn't working with 1.7.0)

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: apt install apm-server

**Fresh install or upgraded from other version?** : Fresh install

**Is there anything special in your setup?** Logstash output, changed agent configuration (disabled kibana and elasticsearch).

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

Configured a VM on Azure with Ubuntu 18.04 with Logstash and APM Server to receive events from an APM Agent for a .Net Core API hosted in Azure App Services.

APM Server config:

```auto
apm-server:
  host: "0.0.0.0:8200"

  ilm:
    enabled: "false"

output.logstash:
  enabled: true
  hosts: ["localhost:5044"]
  escape_html: true

```

.Net Core appsettings:

```auto
"ElasticApm": {
    "ServerUrl": "https://AzureVmUrl",
    "ServiceName": "XemanticA.Web.Backend"
  }

```

.Net Core packages for logs:

```auto
Elastic.Apm.NetCoreAll 1.7.0 -> 1.9.0
NLog.Web.AspNetCore 4.9.3

```

TCP Connection to the Azure VM through port 8200 is enabled and working.

When running the app, the Elastic package or APM Agent can't send events to the APM Server.

**Provide logs and/or server output (if relevant)**:  
Changed APM Server url to: AzureVmUrl  
Changed app name to: WebApp  
Changed SQL Queries to: SQLQuery

[Full log (pastebin)](https://pastebin.com/LdGPrXQM)

---

<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:** [April 6, 2021, 6:14pm UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/2 "2021-04-06T18:14:20Z")

</div>

Hi @Rolfen,

based on the attached logs, to me this looks that the .NET application with the agent can't communicate with the APM Server. It already fails when it tries to read APM server info:

```auto
[2021-04-06 12:21:23.7629] - [WARN] - [Elastic.Apm.Extensions.Hosting.NetCoreLogger.Log (0)] - {PayloadSenderV2} Failed reading APM server info

```

And then when the agent tries to send the events, it fails as well:

```auto
[2021-04-06 12:21:45.2071] - [WARN] - [Elastic.Apm.Extensions.Hosting.NetCoreLogger.Log (0)] - {PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server (https://AzureVmUrl/):

```

For both of these logs, the agent also prints the exception which happens during the HTTP communication - I don't see those in your logs. How do you collect these logs? Can you print the exceptions? That would reveal more.

Bot overall this looks to me that the agent can't talk to the APM server and seems like an HTTP connection issue - I'd expect the exception being something about the connection.

---

<div class="post-metadata">

**Author:** ![Rolfen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rolfen/32/86634_2.png) [@Rolfen](https://discuss.elastic.co/u/Rolfen)\
**Post date:** [April 7, 2021, 3:48pm UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/3 "2021-04-07T15:48:12Z")

</div>

I'm getting the logs from the output console of Visual Studio Enterprise, Its not printing the exceptions and thats why I'm lost, because I haven't been able to narrow down the problem. The Elastic log level is set to Debug, shouldn't it be enough to capture exceptions if they are thrown?

Also, as you are specifying that the communications is through http/https I checked the connection to the server and it's working fine for ports 80 and 442, but still can't communicate with the APM Server.

---

<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:** [April 28, 2021, 11:48am UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/4 "2021-04-28T11:48:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [April 30, 2021, 6:16am UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/5 "2021-04-30T06:16:58Z")

</div>

> [@Rolfen](#):
>
> I checked the connection to the server and it's working fine for ports 80 and 442

Based on the APM server config, APM server is listening on port 8200; Does `"https://AzureVmUrl"` in the APM .Net agent `ServerUrl` also contain port 8200?

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [May 13, 2021, 10:46pm UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/6 "2021-05-13T22:46:06Z")

</div>



---

<div class="post-metadata">

**Author:** ![Rolfen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rolfen/32/86634_2.png) [@Rolfen](https://discuss.elastic.co/u/Rolfen)\
**Post date:** [May 18, 2021, 5:01pm UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/7 "2021-05-18T17:01:37Z")

</div>

Before I had the ServerUrl like `"https://AzureVmUrl:8200"` and it already wasn't working. Somewhere I read that adding the `":8200"` to the ServerUrl didn't matter so I got rid of it, but now I tried again adding the port, and still, it can't connect.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [May 26, 2021, 1:11am UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/8 "2021-05-26T01:11:31Z")

</div>

> [@Rolfen](#):
>
> I tried again adding the port, and still, it can't connect.

What's the error in the agent logs?

Are you able to make a GET request to `https://AzureVmUrl:8200` from the VM and get a successful response?

---

<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:** [November 4, 2022, 8:28am UTC](https://discuss.elastic.co/t/payloadsenderv2-failed-sending-events-following-events-were-not-transferred-successfully-to-the-server/269363/9 "2022-11-04T08:28:10Z")

</div>


