Azure前门配置了最低TLS 1.2。后端Azure App Service还配置为使用最低TLS 1.2。
[在Windows Server 2012 R2上使用以下代码运行.Net Framework 4.7.1控制台应用程序时:
class Program
{
static async Task Main(string[] args)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var client = new HttpClient();
try
{
var OK = await client.GetAsync("https://foo-appservice.azurewebsites.net/"); // App service.
var NotOK = await client.GetAsync("https://foo.myfoo.io/"); // Front door.
}
catch (Exception e)
{
Console.WriteLine(e);
}
Console.ReadKey();
}
}
我在第二次通话中收到以下异常。
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.
但是,使用同一台服务器的curl可以运行它,但是:
curl https://foo.myfoo.io/ -i --tlsv1.2 --tls-max 1.2
相同的.net代码可以从我的其他Windows 10笔记本电脑正常运行。
Windows服务器上的呼叫失败的原因可能是什么?
编辑:
我认为这与自定义域有关,因为对前门分配的域执行简单的GET即可。
原来“某人”已禁用Windows Server上的许多密码套件。
我使用wireshark来查看TLS握手,并注意到客户端Hello中列出的密码套件与服务器不匹配。
因此,对于任何遇到TLS错误的人来说,值得一看的是Wireshark中的TLS握手!