HttpClient
访问https
的时候报错:
The request was aborted: Could not create SSL TLS secure channel.
这样修改:
var url = "https://..."; if (url.ToLower().StartsWith("https")) { System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; } using (var client = new HttpClient()) { var r = await client.GetAsync(url); var s = await r.Content.ReadAsStringAsync(); }