private static void GetTaken(out object accessTaken)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;

       var backMsg = new WebClient().DownloadString("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + Utils.GetCookie("appid") + "&secret=" + Utils.GetCookie("appsecret")); dynamic backObj = JsonConvert.DeserializeObject(backMsg); if (backObj.access_token != null) { accessTaken = backObj.access_token; return; } throw new InvalidOperationException("获取AccessTaken失败!" + backObj.errcode.ToString() + backObj.errmsg.ToString()); }

在做项目的时候,get微信端获取accessTaken的时候老是报错,如下图

关于:请求被终止,未能创建SSL/TLS安全通道的 解决方法
在百度了好多方法后,发现在请求前加上最上面代码中的红色背景部分的代码后再请求就不会出现这个问题了。

相关文章:

  • 2022-12-23
  • 2021-09-27
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
猜你喜欢
  • 2021-11-27
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案