ssl - 我必须在 Paypal 中使用 SSL 吗?如何在 Windows Azure 上设置 Paypal?

标签 ssl paypal paypal-ipn azure-web-app-service azure-virtual-network

我正在将 3 年前运行的旧 Web 应用程序放到网上。 当时一切正常,Paypal 的 ExpressCheckout 设置完美。

我真的不记得我当时在做什么,但现在我把我的应用程序放在了 Windows Azure 上。我的应用程序是用 ASP.NET MVC5 编写的。

对于那些在您的应用程序中实现了 Paypal 的人来说,下面这段代码可能看起来很熟悉,它可能取自 Paypal 的文档并用于向 Paypal 的服务器发送消息:

    /// <summary>
    /// HttpCall: The main method that is used for all API calls
    /// </summary>
    /// <param name="NvpRequest"></param>
    /// <returns></returns>
    public string HttpCall(string NvpRequest) //CallNvpServer
    {
        string url = pendpointurl;

        //To Add the credentials from the profile
        string strPost = NvpRequest + "&" + buildCredentialsNVPString();
        strPost = strPost + "&BUTTONSOURCE=" + HttpUtility.UrlEncode(BNCode);

        HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
        objRequest.Timeout = Timeout;
        objRequest.Method = "POST";
        objRequest.ContentLength = strPost.Length;
        objRequest.ContentType = "application/x-www-form-urlencoded";

        try
        {
            using (StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream()))
            {
                myWriter.Write(strPost, 0, strPost.Length);
            }
        }
        catch (Exception e)
        {
            CommonFuncs.Log(MyGlobals.LOG_FILE_DO_EXPRESS_CHECKOUT, e.Message);
            return null;
            /*
            if (log.IsFatalEnabled)
            {
                log.Fatal(e.Message, this);
            }*/
        }


        //Retrieve the Response returned from the NVP API call to PayPal
        HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
        string result;
        using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
        {
            result = sr.ReadToEnd();
        }

        //Logging the response of the transaction
        /* if (log.IsInfoEnabled)
         {
             log.Info("Result :" +
                       " Elapsed Time : " + (DateTime.Now - startDate).Milliseconds + " ms" +
                      result);
         }
         */
        return result;
    }

现在,当我尝试 POST(此处)

using (StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream()))
                {
                    myWriter.Write(strPost, 0, strPost.Length);
                }

我收到以下错误消息

The request was aborted: Could not create SSL/TLS secure channel.

这是否意味着我必须购买 SSL 证书?还是我只需要在 Azure 上做一些调整就可以正常工作?

最佳答案

无需购买 SSL。但您可以将证书升级为 SHA 256 和 TLS 1.2。请参阅下面的链接。

https://www.paypal-knowledge.com/infocenter/index?page=content&id=FAQ1913

https://github.com/paypal/TLS-update

关于ssl - 我必须在 Paypal 中使用 SSL 吗?如何在 Windows Azure 上设置 Paypal?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36231660/

相关文章:

带有 ssl 和反向代理的 WordPress (nginx)

delphi - 使用 Indy 和 Delphi 10 连接 SSL 时出错

php - 使用 codeigniter 处理 Paypal 付款

c# - Paypal 与 mvc 集成

php - Paypal IPN 取消订阅,发送新的登录信息?

http - NGiNX - 重定向到 https 无法通过最初请求的子域重写/替换正确的通配符字符

ssl - Kafka 在尝试开始使用 PEM 证书时返回 "No matching PRIVATE KEY entries in PEM file"

php Paypal .一种在接受付款之前验证付款的方法

php - Paypal IPN 和 wordpress 失败

用于订阅协议(protocol)的 Paypal IPN