网站程序中请求别的API地址报错:The underlying connection was closed: An unexpected error occurred on a reception
百度了一下,说是服务器请求HTTPS资源时的安全问题。解决方法是在代码中发送请求前加入下面的代码
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;//这个是单独加的代码 WebRequest HttpWebRequest = WebRequest.Create(Url);