In our SDL Web 8.5 environment we have an Event Handler, which does a POST request to a .NET Core API (hosted on another server).
The request results in the following error:
One or more errors occurred. An error occurred while sending the request. The underlying connection was closed: An unexpected error occurred on a send. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host
Component: Tridion.ContentManager Errorcode: 0 User: NT AUTHORITY\SYSTEM
The interesting thing is that when I do the same request via Postman from the same server, the requests succeeds.
My code in the Event Handler looks like this:
var client = new HttpClient
{
BaseAddress = new Uri(endPoint),
Timeout = new TimeSpan(0, 0, 20)
};
var x = client.PostAsync($"/api/{rootElementName}", content).Result;
Another interesting detail is that this does work on our development server.