How can a ServerXMLHTTP GET request hang?

最后都变了- 提交于 2020-01-13 05:53:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!