【发布时间】:2020-04-27 13:38:25
【问题描述】:
我尝试通过控制台应用程序运行简单的 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 有设置
您能否建议我可以调查什么?
【问题讨论】:
-
使用像wireshark或fiddler这样的嗅探器并比较来自工作和非工作应用程序的第一个请求。 c# 默认标头与其他应用程序不同。修复修改 c# 标头以使其看起来像工作应用程序。服务器可能不支持所有 TLS 模式。通常,当您 OR TLS 模式时,必须分别尝试每种模式。因此,您首先尝试 tls 1.0,如果失败,请尝试 tls 1.2,最后尝试 tls1.2
-
Hello @jdweng SSLv3-compatible ClientHello 握手中的问题谢谢将调查
-
您的证书是否与 v3 加密兼容?见维基:en.wikipedia.org/wiki/Transport_Layer_Security。代码是否适用于早期版本的网络?有很多关于升级到 SSL/TLS 停止工作的最新网络的人的帖子。怀疑 Net 中的默认加密模式已更改为使用最新模式。然后代码不向后/向前兼容。
-
我比较了密码,发现密码不同
-
你能修改吗?
标签: c# frameworks httprequest tls1.2 .net-4.7.2