【发布时间】:2012-09-23 12:45:43
【问题描述】:
在从 SetExpressCheckOut 获得令牌和 payerID 后,我现在希望真正从用户那里获得钱。
使用 paypal 函数向导生成的代码,我正在调用 ConfirmPayment 函数。
问题是该函数被成功调用并处理来自用户的付款,但随后我收到超时错误。所以我得到了他们的钱,而用户得到了一个超时页面。不是留住客户的最佳方式。
The operation has timed out
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The operation has timed out
Source Error:
Line 313:
Line 314: //Retrieve the Response returned from the NVP API call to PayPal
**Line 315: HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();**
Line 316: string result;
Line 317: using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
我在第 315 行遇到超时,该超时源自 paypal 函数的 HTTPCall 函数。
public string HttpCall(string NvpRequest) //CallNvpServer { 字符串 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;
//Retrieve the Response returned from the NVP API call to PayPal
**HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();** (Line 315)
string result;
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
}
return result;
}
我觉得这可能与 Paypal 的服务器有关,但无论哪种方式,它都不起作用,并且如果它上线会惹恼用户。你们知道为什么会突然超时吗?之前在 SetExpressCheckOut 中使用了相同的 HTTPCall,并且工作正常。
【问题讨论】:
标签: c# asp.net paypal paypal-sandbox