C#不支持此安全协议

  开始在本地调用HTTPS接口的时候,程序抛出”基础连接已关闭“的错误。

  后来在代码中加上:

  ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

  ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;

  本地程序不报错,接口可以成功返回数据(本地.net framwork 3.5)

  结果放到服务器后,  程序又出现”不支持此安全协议的错误“。

  然后下载安装了:https://support.microsoft.com/zh-cn/help/3154519/support-for-tls-system-default-versions-included-in-the-net-framework  之后就可以调用成功了。

 

 

   

 

posted @ 2020-01-17 11:14  垂帘落地  阅读(2601)  评论(0编辑  收藏  举报