1

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.

1

These servers have restricted which TLS version can be used. Adding the following line of code fixed the issue:

System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.