2012-10-02 36 views
0

從SetExpressCheckOut獲取令牌和payerID後,現在我正在尋找實際從用戶那裏得到的錢。DoExpressCheckoutPayment處理付款,然後超時

使用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())) 

我得到了一個來自PayPal函數的HTTPCall函數的第315行超時。

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; 
    //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,並且正常工作。

回答

0

看起來好像paypalfunctions.cs中有一個變量指示頁面超時。它被設置爲5000,並且由於頁面加載時間超過5秒並且超時,我只是將其提高到50000。