每隔一段时间,Paypal 就会向我的 .net 应用程序 ipn 脚本返回一个 500 错误代码。它在对验证请求的响应中返回该代码
这是记录的错误:
System.Net.WebException 远程服务器返回错误:(500)内部服务器错误。
System.Web.HttpUnhandledException (0x80004005):引发了“System.Web.HttpUnhandledException”类型的异常。---> System.Net.WebException:远程服务器返回错误:(500)内部服务器错误。在 System.Net.HttpWebRequest.GetResponse() 在 ASP.ipn_aspx.Page_Load(Object sender, EventArgs e)
我用于通话的代码是:
endPoint = "https://www.paypal.com/cgi-bin/webscr";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(endPoint);
//Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
string strRequest = Encoding.ASCII.GetString(param);
strRequest += "&cmd=_notify-validate";
req.ContentLength = strRequest.Length;
//Send the request to PayPal and get the response
StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
string strResponse = streamIn.ReadToEnd();
streamIn.Close();
这可能每天发生一次,并且 PayPal 不会重试 ipn 消息。其他 95% 的 PayPal ipn 交易运行良好。有任何想法吗?