gpt4 book ai didi

.net - 请求被中止 : Could not create SSL/TLS secure channel sandbox account

转载 作者:太空宇宙 更新时间:2023-11-03 15:38:35 25 4
gpt4 key购买 nike

它在一周前运行良好,但现在显示以下错误。我尝试了以下方法但没有用。

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

所以建议我可能的解决方案

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);

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
// allows for validation of SSL conversations
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };


HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.Timeout = Timeout;
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;

try
{
using (StreamWriter myWriter = new StreamWriter(objRequest.GetRequestStream()))
{
myWriter.Write(strPost);
}
}
catch (Exception e)
{
/*
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;
}

最佳答案

我刚刚在我的测试环境中也遇到了同样的问题(幸运的是我的实时付款正在进行中)。我通过更改修复了它:

public PayPalAPI(string specialAccount = "")
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;

public PayPalAPI(string specialAccount = "")
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

他们不久前禁用了对 SSL3 的支持:https://www.paypal.com/uk/webapps/mpp/ssl-security-update ,具体说明

Ensure you are connecting to PayPal endpoints using TLS 1.0 or 1.2 (not all API endpoints currently support TLS 1.1).

他们的 latest update (感谢来自@awesome 的评论更新)状态:

PayPal is updating its services to require TLS 1.2 for all HTTPS connections. At this time, PayPal will also require HTTP/1.1 for all connections... To avoid any disruption of service, you must verify that your systems are ready for this change by June 17, 2016

关于.net - 请求被中止 : Could not create SSL/TLS secure channel sandbox account,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34939523/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com