今天接第三方支付遇到一个问题。
在使用POST 提交到第三方支付平台时,发生异常,“请求被中止: 未能创建 SSL/TLS 安全通道”。
产生问题的场景:
1、第三方支付平台接口使用的是https://xxxxx.api.com/pay
2、我的项目使用的是.net framework 4.0版本
解决问题的方法:
在提交请求前,加入下面这行代码
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
完美解决!
参考链接如下:
https://blog.csdn.net/He_lh/article/details/78594901(.net framework 4.0 解决方法 )
https://q.cnblogs.com/q/98826/