要解决"Asp.net core 2.0 TLS 1.2异常"客户端和服务器无法通信,因为它们没有共同的算法"问题,您可以按照以下步骤进行操作:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client
在Client文件夹中,确保以下两个键存在并将其值设置为1:
DisabledByDefault = 0
Enabled = 1
var httpClientHandler = new HttpClientHandler();
httpClientHandler.SslProtocols = SslProtocols.Tls12;
var httpClient = new HttpClient(httpClientHandler);
这些步骤应该能够解决您遇到的TLS 1.2异常问题。请注意,这些解决方法可能因您的具体环境而有所不同,所以请根据您的具体情况进行调整。