The program I wrote in c# works fine in local (windows 10) but on my server it gives the error "Request aborted: Failed to create SSL/TLS secure channel." . my server is windows server 2012 r2 why am i getting this error can you help me.
Could it be related to the security policies of the website I'm requesting? (There is no problem when I send requests to other websites with the code below)
This Code:
private void Form1_Load(object sender, EventArgs e)
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls13;
}
I changed the tls versions. I updated the .netframework(4.8) but the result is the same, when I send a request to other sites, there is no problem from the server again.
Follow these steps for Windows Server 2012 R2.
Note:- If the URL/API you are hitting doesnot support TLS 1.2 (only supports TLS 1.3). Then the only way for you to is to upgrade Windows server to at least Windows Server 2019. TLS 1.3 is not supported by Windows Server 2012 / R2