I am trying to send an HTTP POST to the address https://www.linkedin.com/oauth/v2/accessToken?grant_type=.... using a HttpClient class from C#. When I run the code on my local Win10, or when I run it on Windows Server 2016, it works fine.
However, when I run it from Windows Server 2008 R2, I am getting the error
An existing connection was forcibly closed by remote host.
Now, I know that LinkedIn does support only TLS 1.2 since a while. I tried to explicitly set TLS in my code:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
Still the same error on Win2008R2. I tried targeting .Net Framework 4.6.1, 4.7.1, 4.7.2, to no avail.
What could be the problem?
I saw already threads on SO like these: Twitter API responds with 'An existing connection was forcibly closed by the remote host'
Does not work however for me.