我嘗試連接到內部網站,使用正確簽名的SSL證書(在Chrome 58的工作),但是當我在.net中執行此代碼,它拋出錯誤:SSL/TLS誤差了HTTPClient
The Request was aborted: Could not create SSL/TLS channel.
ServicePointManager.MaxServicePointIdleTime = 0;
ServicePointManager.Expect100Continue = true;
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://internal-website");
request.Headers.Add("token", "---");
var result = client.SendAsync(request);
result.Wait();
我能想到的唯一原因是證書使用DNS名稱的主題備用名稱(它有4個條目),CN與它們中的任何一個都不匹配,但它仍然可以在Chrome和Postman中使用。
我在創建HttpClient之前添加的代碼是禁用SSL檢查,但它沒有工作任何想法如何我可以調試此問題?
接通高冗長跟蹤:https://msdn.microsoft.com/ en-us/library/ty48b824(v = vs.110).aspx –
任何特定的東西,我應該看看那個痕跡? – baalazamon