【问题标题】:MSXML2.XMLHTTP60 request fails for standard user but works for local administrator标准用户的 MSXML2.XMLHTTP60 请求失败,但适用于本地管理员
【发布时间】:2016-07-14 08:54:59
【问题描述】:

我为我们的 Microsoft Access 2010 数据库/应用程序编写了一个函数,用于从供应商的 Web 服务中检索一些数据。这是一个非常简单的操作,在我的登录名(本地管理员帐户)下可以正常工作,但不适用于其 PC 上的标准用户。

  Dim http As New XMLHTTP60
  Dim strRequestData As String

  'Build the request
  strRequestData = _
    "<xml><somedata></somedata></xml>"

  'Send request
  http.Open "POST", "https://oursupplier.com/access/access.htm", True
  http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  http.Send "XML=" & strRequestData

  'Wait for response
  Dim I As Integer
  Do Until http.ReadyState = 4 'Completed

    'Only wait 500*40 (20 seconds)
    I = I + 1

    If I > 40 Then
      MsgBox "Operation timed out (20 seconds)."
      http.abort
      Exit Function
    End If

    Sleep 500
    DoEvents
  Loop

  If http.status = 200 Then
    ReturnValue = http.responseText
  Else
    On Error Resume Next 'Don't error if we can't read a property

    MsgBox "Request failed - HTTP status '" & http.status & " " & http.StatusText & "'"

    LogMessage "logfile.txt", "*** Request failed ***"
    LogMessage "logfile.txt", "HTTP Status: " & http.status
    LogMessage "logfile.txt", "HTTP Status Text: " & http.StatusText
    LogMessage "logfile.txt", "Request: " & "XML=" & strRequestData
    LogMessage "logfile.", "Response: " & http.responseText
    On Error GoTo 0
  End If

  'Clean up
  Set http = Nothing

记录的错误是:

  14/07/2016 9:04:08 am *** Request failed ***
  14/07/2016 9:04:08 am HTTP Status: 12004
  14/07/2016 9:04:08 am HTTP Status Text:
  14/07/2016 9:04:08 am Request: <xml><somedata></somedata></xml>
  14/07/2016 9:04:08 am Response:

12004 表示 ERROR_INTERNET_INTERNAL_ERROR(发生内部错误。)

为什么用户的权限会影响“内部错误”?我猜它不是在谈论 500 的 HTTP 响应代码?

【问题讨论】:

    标签: xml ms-access vba


    【解决方案1】:

    我将 XMLHTTP60 更改为 ServerXMLHTTP60。此类无需本地管理员权限即可工作。

    我不知道为什么这可以解决问题。

    Dim http As New ServerXMLHTTP60
    

    【讨论】:

      猜你喜欢
      • 2019-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多