【问题标题】:PayPal PayFlowPro COMException 0x8000000APayPal PayFlowPro COMException 0x8000000A
【发布时间】:2014-01-15 20:26:24
【问题描述】:

我们有一些代码可以运行以连接到 PayPal 的 PayFlowPro,以更新定期计费订阅中使用的信用卡。这段代码过去在 .Net 2 应用程序池下可以正常工作,但是当我们将其迁移到 4.0 时,它非常棘手——有时它可以工作,有时则不能。代码看起来很简单,所以我不确定问题是什么。

错误是:System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Runtime.InteropServices.COMException (0x8000000A): The data necessary to complete this operation is not yet available.

间歇性失败的代码块(但用于在旧服务器上工作)是:

Try
objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
objWinHttp.Open("POST", GatewayHost, False)
objWinHttp.setRequestHeader("Content-Type", "text/namevalue") ' for XML, use text/xml
objWinHttp.SetRequestHeader("X-VPS-Timeout", "90")
objWinHttp.SetRequestHeader("X-VPS-Request-ID", requestID)

objWinHttp.Send(parmList)
 Catch exc As Exception

 End Try

 ' Get the text of the response. (DIES ON LINE BELOW)
 transaction_response = objWinHttp.ResponseText

令人困惑的部分是它间歇性地工作,这总是最难调试。这是多年来一直存在的东西,唯一的区别是我们的应用程序池现在在 .Net 4 与 .Net 2.0 下运行,但我认为这不是问题。我把它翻回了 2.0,现在它可以完美地工作了。

关于从哪里开始寻找的任何猜测? WinHttp.WinHttpRequest.5.1 在 .Net 4 中有问题吗?旧服务器是 2008 R2,新服务器是 2012 R1,所以也许这也是其中的一部分?

更新 - 更改为 2.0 仍然没有解决问题。它正在工作,然后又停止了。这没有任何意义。

【问题讨论】:

    标签: vb.net paypal comexception winhttprequest


    【解决方案1】:

    由于这是在内联 .Net 代码中(未编译),我只是将它迁移到 System.Net.HttpWebRequest,而不是它似乎工作得更好。这是其他人的示例代码:

    Dim data As Byte() = New System.Text.ASCIIEncoding().GetBytes(parmList)
    Dim request As System.Net.HttpWebRequest = CType(System.Net.HttpWebRequest.Create(GatewayHost), System.Net.HttpWebRequest)
    request.Method = "POST"
    request.ContentType = "text/namevalue"
    request.ContentLength = data.Length
    
    Dim requestStream As System.IO.Stream = request.GetRequestStream()
    requestStream.Write(data, 0, data.Length)
    requestStream.Close()
    
    Dim responseStream = New System.IO.StreamReader(request.GetResponse().GetResponseStream())
    transaction_response = responseStream.ReadToEnd()
    responseStream.Close()
    

    【讨论】:

      猜你喜欢
      • 2017-04-06
      • 2023-03-05
      • 2012-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-04
      • 2014-11-06
      相关资源
      最近更新 更多