我遇到的问题与this question中的问题相同。
var handler = new WebRequestHandler();
handler.ClientCertificates.Add(cacert2);
var client = new HttpClient(handler, true);
var result = await client.PostAsync(uri, content); //tls 1.0
对服务的此请求仅适用于默认的安全协议(TLS)。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls; //default .net 4.5
如果我使用
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
,该服务显示错误400 No required SSL certificate was sent
。
如何为每个httpclient设置协议?