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