如何通过HTTP Get请求解决问题

问题描述 投票:0回答:1

我尝试通过控制台应用程序运行简单的GET HTTP请求。.NET框架4.7.2语言是C#。

class Program
{
    static readonly HttpClient _httpClient = new HttpClient();

    static void Main(string[] args)
    {
        try
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls /*| SecurityProtocolType.Ssl3*/;


            string versionTxtUri = "https://connect.palmbeachschools.org/version.txt";
            string versionTxtContent = _httpClient.GetStringAsync(versionTxtUri).GetAwaiter().GetResult();
            Console.WriteLine(versionTxtContent);
            Console.ReadLine();
        }
        catch(Exception ex)
        {
            Console.WriteLine(ex.Message);
            Console.WriteLine(ex.InnerException);
        }
    }
}

当我在WinServer2012 R2标准上运行应用程序时出现错误

The request was aborted: Could not create SSL/TLS secure channel.

当我在Windows 10或WindowsServer 2016上运行时,Standart IT可以。有效。

根据IISCrypto Windows Server 2012具有设置enter image description here

您能建议我可以进行调查吗?

c# frameworks httprequest tls1.2 .net-4.7.2
1个回答
0
投票

解决方案是添加这些密码套件

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
SSL_RSA_WITH_3DES_EDE_SHA
© www.soinside.com 2019 - 2024. All rights reserved.