今天接第三方支付遇到一個問題。
在使用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/