之前遇到一个问题
https://www.cnblogs.com/leoxjy/p/10201046.html
在centos 7.x HttpClient访问会出问题 The SSL connection could not be established, see inner exception
最后彻底解决是进入容器docker
那么 最近又翻墙搜到一个解决方案 可以systemctl 运行的时候也不会 SSL
上代码
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true
};
using (HttpClient client = new HttpClient(httpClientHandler))
{
string url = WeiXinSettings.GetJscode2Session(code);
var result = await client.GetAsync(url);
if (result.IsSuccessStatusCode)
{
string str = await result.Content.ReadAsStringAsync();
return str;
}
}
所有评论(0)