问题
I am using PayPalStandard plugin of NopCommerce. When I placed the order & make payment with paypalstandard plugin after successful payment on paypal, it redirects to merchants site. At that time it gives error:
The request was aborted: Could not create SSL/TLS secure channel.
Also I am using Sandbox account of Paypal for testing.
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);
回答1:
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." appeared.
I believe PayPal updated their endpoints on 19/20 January 2016 to use TSL 1.2 and HTTP 1.1.
To resolve this, for .NET 4.5 and above add the following line of code before calling WebRequest.Create().
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
回答2:
The answer that worked for us was listed on the PayPal blog post, Upcoming Security Changes Notice. There are a number of things listed in the post, but the one thing which we did, and that worked, was PayPal SDK Updates. We updated using NuGet and everything started working again.
来源:https://stackoverflow.com/questions/34945002/the-request-was-aborted-could-not-create-ssl-tls-secure-channel-system-net-webe