I have a VBS that makes a large number of GET requests using a ServerXMLHTTP object:
SET xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.setTimeouts 5000, 5000, 10000, 120000 'ms - resolve, connect, send, receive
...
' Now do the following for lots of different GetURLs:
xmlhttp.open "GET", GetURL, false
xmlhttp.setRequestHeader "Content-type","text/xml"
xmlhttp.setRequestHeader "Accept","text/csv"
xmlhttp.send "{}"
WScript.Echo "Readystate = " & xmlhttp.readyState & " at " & Now()
IF xmlhttp.readyState <> 4 THEN
xmlhttp.waitForResponse 1
END IF
WScript.Echo "Readystate = " & xmlhttp.readyState & " at " & Now()
I've found cases where the script never gets past xmlhttp.send
unless I run it asynchronously (i.e., using xmlhttp.open "GET", GetURL, true
).
My understanding is that it should time-out, per the setTimeouts, and move ahead even when run synchronously. So what could be going on? (Based on reading so far it sounds like "a lot," but documentation on this is murky at best...)
来源:https://stackoverflow.com/questions/35638066/how-can-a-serverxmlhttp-get-request-hang