異常信息
The SSL connection could not be established, see inner exception ---> AuthenticationException: The remote certificate is invalid according to the validation procedure
背景
吐血大坑 N小時奮斗 issues
證書問題 原因不詳
using (var client = new HttpClient()) { client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"); var html = (client.GetStringAsync("https://*****/").GetAwaiter().GetResult()); Console.WriteLine(html); Console.ReadLine(); }
我的環境
system:centos7.2
netcore sdk 2.2
最后附上解決方案
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0;dotnet build
感謝@曉晨 幫助 怎么清除證書
后記 因為有bug存在 用服務器啟動還是有問題 最后使用docker徹底解決
2019-9-19實在不想 容器化解決 也有辦法 參照我的這篇文章
https://www.cnblogs.com/leoxjy/p/11235028.html