1
我目前正在面臨一些與創建CreateObject("MSXML2.ServerXMLHTTP.6.0")
對象有關的問題。CreateObject(「MSXML2.ServerXMLHTTP.6.0」)
Public Function PrepareHttpRequest(Request As RestRequest, TimeoutMS As Long, _
Optional UseAsync As Boolean = False) As Object
Dim Http As Object
**Set Http = CreateObject("MSXML2.ServerXMLHTTP.6.0")**
' Set timeouts
Http.setTimeouts TimeoutMS, TimeoutMS, TimeoutMS, TimeoutMS
' Add general headers to request
Request.AddHeader "User-Agent", UserAgent
Request.AddHeader "Content-Type", Request.ContentType
If Request.IncludeContentLength Then
Request.AddHeader "Content-Length", Request.ContentLength
Else
If Request.Headers.Exists("Content-Length") Then
Request.Headers.Remove "Content-Length"
End If
End If
' Pass http to request and setup onreadystatechange
If UseAsync Then
Set Request.HttpRequest = Http
Http.onreadystatechange = Request
End If
Set PrepareHttpRequest = Http
End Function
上面的代碼對一些用戶來說工作正常,但在某些用戶機器上卻失敗了。任何人都可以提供必要的修改來解決問題。
歡迎來到[so]。 – 2015-03-19 07:28:24