简体   繁体   English

请求已中止:无法创建SSL / TLS安全channel.System.Net.WebException

[英]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.

相关问题 WebException:请求已中止:无法创建SSL / TLS安全通道 - WebException: The request was aborted: Could not create SSL/TLS secure channel 请求被中止无法在共享主机服务器C#上创建ssl / tls安全通道 - the request was aborted could not create ssl/tls secure channel on shared hosting server C# 即使在指定ServicePointManager.SecurityProtocol之后,HttpWebRequest中的“请求已中止:无法创建SSL / TLS安全通道” - “The request was aborted: Could not create SSL/TLS secure channel” in HttpWebRequest, even after specifying ServicePointManager.SecurityProtocol Invoke-WebRequest:请求被中止:无法创建 SSL/TLS 安全通道 - Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel 无法创建SSL / TLS安全通道 - 作为exe工作但不在asp.net mvc中工作 - Could not create SSL/TLS secure channel - works as exe but not in asp.net mvc 我如何修复 ASP.NET 中的无法创建 SSL/TLS 安全通道错误 - How do i fix the Could not create SSL/TLS secure channel Error in ASP.NET 无法使用 IIS 的权限为 SSL/TLS 建立安全通道 - Could not establish secure channel for SSL/TLS with authority from IIS 无法为具有权限“本地主机”的SSL / TLS安全通道建立信任关系 - Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost' strange issue Amazon S3错误 - 无法为SSL / TLS安全通道建立信任关系 - Amazon S3 error - Could not establish trust relationship for the SSL/TLS secure channel NEST与ElasticSearch System.net.WebException - NEST with ElasticSearch System.net.WebException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM