C#HTTP请求RestSharp.RestClient/HttpWebRequest发起https请求报错

C# RestSharp.RestClient/HttpWebRequest发起https请求时返回总是空

response.Content总是空

查看response.ErrorMessage属性发现报错信息

The SSL connection could not be established, see inner exception.

或者报错信息

Request failed with status code InternalServerError

解决办法

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

 

posted @ 2023-03-29 11:57  立扬  阅读(632)  评论(0编辑  收藏  举报
……