[英]The request was aborted: Could not create SSL/TLS secure channel.System.Net.WebException
I am using PayPalStandard plugin of NopCommerce. 我正在使用NopCommerce的PayPalStandard插件。 When I placed the order & make payment with paypalstandard plugin after successful payment on paypal, it redirects to merchants site.
当我在paypal成功付款后下订单并使用paypalstandard插件付款时,它会重定向到商家网站。 At that time it gives error:
那时它给出了错误:
The request was aborted: Could not create SSL/TLS secure channel.
请求已中止:无法创建SSL / TLS安全通道。
Also I am using Sandbox account of Paypal for testing. 我也使用Paypal的Sandbox帐户进行测试。
It throws error from this line: 它从这一行抛出错误:
var sw = new StreamWriter(req.GetRequestStream()
Here is code below: 这是下面的代码:
var req = (HttpWebRequest)WebRequest.Create(GetPaypalUrl());
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ProtocolVersion = HttpVersion.Version10;
string formContent = string.Format("cmd=_notify-synch&at={0}&tx={1}", _paypalStandardPaymentSettings.PdtToken, tx);
req.ContentLength = formContent.Length;
using (var sw = new StreamWriter(req.GetRequestStream(), Encoding.ASCII))
sw.Write(formContent);
I had the same issue connecting to sandbox(nvp), everything was fine then yesterday the message "The request was aborted: Could not create SSL/TLS secure channel." 我有同样的问题连接到沙盒(nvp),一切都很好,然后昨天消息“请求被中止:无法创建SSL / TLS安全通道。” appeared.
出现了。
I believe PayPal updated their endpoints on 19/20 January 2016 to use TSL 1.2 and HTTP 1.1. 我相信PayPal在2016年1月19日更新了他们的终端,以使用TSL 1.2和HTTP 1.1。
To resolve this, for .NET 4.5 and above add the following line of code before calling WebRequest.Create(). 要解决此问题,对于.NET 4.5及更高版本,在调用WebRequest.Create()之前添加以下代码行。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
The answer that worked for us was listed on the PayPal blog post, Upcoming Security Changes Notice . 对我们有用的答案列在PayPal博客文章即将发布的安全变更通知中 。 There are a number of things listed in the post, but the one thing which we did, and that worked, was PayPal SDK Updates .
帖子中列出了许多内容,但我们做过的一件事就是PayPal SDK更新 。 We updated using NuGet and everything started working again.
我们使用NuGet进行了更新,一切都开始了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.