.NET Core参考代码,推荐;
//忽略SSL证书验证
var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = delegate { return true; };
HttpClient httpClient = new HttpClient(handler);
.NET Framework参考代码
//忽略 SSL/TLS 证书验证。
httpClient.DefaultRequestHeaders.ExpectContinue = false;
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
参考
https://www.cnblogs.com/RaymonGoGo/p/16705733.html