我有一个使用ServerXMLHTTP对象发出大量GET请求的VBS:
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()
我发现脚本从不超过xmlhttp.send
的情况除非我异步运行(即使用xmlhttp.open "GET", GetURL, true
)。
我的理解是它应该按照setTimeouts超时,并且即使在同步运行时也要向前移动。那么可能会发生什么? (基于到目前为止的读数,它听起来像“很多”,但关于此的文档充其量是晦暗的......)