Msxml2.ServerXMLHTTP and Time Out

Discussion in 'ASP General' started by NeedHelp, Feb 11, 2010.

  1. NeedHelp

    NeedHelp Guest


    I am using following code in my asp file:

    Set xml = Server.CreateObject("Msxml2.ServerXMLHTTP")
    xml.Open "GET", url, False
    s = xml.responseText
    Set xml = Nothing

    Sometimes (not always), the asp file didn't work and returned Time
    Out. Every time when it happend, I immediately clicked the refresh
    button of my bowser and the asp file would work fine.

    I think there must be something I am missing....Do you have any idea?
    NeedHelp, Feb 11, 2010
    1. Advertisements

  2. NeedHelp

    Evertjan. Guest

    NeedHelp wrote on 11 feb 2010 in microsoft.public.inetserver.asp.general:
    It seems that the "url" was not responding quick enough now and then.

    You could manipulate 4 different timeouts:

    Perhaps using onreadystatechange would help?
    Evertjan., Feb 11, 2010
    1. Advertisements

  3. NeedHelp

    NeedHelp Guest

    Thank you.
    I don't want to set the timeout because I need the "url" responding as
    fast as possible. It seems to me that after the timeout, I can get
    responding quickly (immediately) by click the refresh button (run
    the file second time), Why not responds quickly at the first time?
    NeedHelp, Feb 11, 2010
  4. NeedHelp

    Evertjan. Guest

    NeedHelp wrote on 11 feb 2010 in

    [please do not quote signatures on usenet]
    Wrong idea.

    A timeout gives the maximum time before an error is raised or a default
    error action is done,

    Such timeout does not slow down ther normal action.
    Because the url stream is only intermittently slow?
    Evertjan., Feb 11, 2010
  5. NeedHelp

    NeedHelp Guest

    Thank you.

    Yes, I believe you are right: A timeout gives the maximum time before
    an error is raised or a default error action is done, And such timeout
    does not slow down ther normal action.
    However, setting timeout wont solve my problem. I want to find why
    whenever timeout error happened and run the code again immediately,
    the code can run with no time. If I find the reason, I might able to
    set something or modify something and never let the timeout error
    display on the users' browsers! (The asp code is running in my web
    NeedHelp, Feb 11, 2010
  6. NeedHelp

    Evertjan. Guest

    NeedHelp wrote on 11 feb 2010 in microsoft.public.inetserver.asp.general:

    [please do not quote signatures on usenet, that is "not done" on usenet.
    Heh, I wrot that is thas last posting too.
    Didn't you read that or don't you agree?]
    Why not?
    I told you, the fetching of an external stream varies in time.
    You cannot help the spead of that stream if that is due to the packet
    stream of the Internet.

    And it is always the first try that is slow, never the second, because if
    the first is all right you do not try a second one.
    The chance of twice slow being the square of a seldom event, so is far
    more seldom.
    Did you disprove my reasoning, or do you simply not read or like it?
    If you set the timeout long enoug, the error will become lmore seldom, if
    my surmize is valid.

    Even so, you can catch errors and deal with it as you like serverside.
    Where else can your ASP-code run?
    Evertjan., Feb 11, 2010
  7. NeedHelp

    NeedHelp Guest

    I believe the page should finish all job in, say 1 second, even in a
    very slow and busy server. There must be something I don't know.
    NeedHelp, Feb 12, 2010
  8. NeedHelp

    Evertjan. Guest

    NeedHelp wrote on 12 feb 2010 in

    This is not about a statement of faith,
    but about facts of life.

    Fact of life is, that the internet is not always that fast,
    so if your page fetches information from another url,
    sometiimes that takes minutes, irrespectful if you believe it or not.

    you make the timout sufficiently large,
    you handle the error in an convenient way,
    you let things go wrong as they are,
    you rebuild the internet to your believes.
    That much I know.
    Evertjan., Feb 12, 2010
  9. NeedHelp

    Mark McGinty Guest

    Isn't there a netiquite rule about being an overly-insistent demanding
    little sniveler? There ought to be, but regardless, I must admit it wasn't
    100% clear to me what you were on about, the first time I read it. But then
    again you're always on about something, which makes your nit-picks easy for
    me to ignore... So when you encounter non-compliance, and feel compelled to
    poll for the reason, you should add "didn't understand" and "don't really
    care" to the list of options.

    Yes but the default timeout is 90 seconds. Unless the request is highly
    processor-intensive, for it to take anywhere near that long is usually
    indicative of at least some problem. Even if absolutely nothing else, very
    few users will wait that long for a web page to load, which constitutes a
    problem in-and-of itself.

    Well, I run ASP code on my workstation pretty often, but that's not
    important. Since the original question involved ServerXMLHTTP, I'm going to
    go out on a limb and assume the ASP code to which the OP referred, is that
    being called by ServerXMLHTTP. (This assumption adds infinite relevance,
    and subtracts that statement-of-the-obvious quality that apparently drew
    your sarcasm, don't you think?)

    To the OP, you are aware that calls to ServerXMLHTTP must not send requests
    to the same virtual server on which the calling script is executing,
    correct? IOW, the script must not
    reference any other ASP script on when calling XMLHTTP.
    Doing so can deadlock the script engine.

    Even calling an XML source on a different virtual but same physical server
    can cause issues, depending on app pools, isolation settings, threading
    models of COM objects being used, etc. So if this is all running on the
    same server box, I strongly suspect some sort of deadlock is intermittently
    occurring. Timeout (like any other error) terminates the request, which
    frees-up whatever resource is in contention, paving the way for the next
    request to succeed as normal.

    A telling test would be, next time the page that calls XMLHTTP takes longer
    than a few seconds to complete, open the same page in another browser. If
    that one hangs too, you've almost certainly got a deadlock on your hands.
    Another diagnostic approach might be to set the timeout for the ASP page
    that renders the XML to something very short (like 2x or 3x max amount of
    time it should ever take to complete.) Then code the caller to check
    status/eat errors/etc and retry a few times upon failure. (By default both
    the caller and callee will timeout almost silmultaneously, but it doesn't
    have to be that way.) Note that I'm not suggesting this for production
    code, only for diagnostics.


    [If you don't want it quoted back, don't append it to your posts.]
    Mark McGinty, Feb 13, 2010
  10. NeedHelp

    Evertjan. Guest

    Mark McGinty wrote on 13 feb 2010 in
    Ignoring my request to adhere to Netiquette urged met to be more insistent,
    and it seems it worked as you feel insulted, which wasn't the intention but
    could be a useful by-product.

    You musst mean p.c.

    You can only do that if you install a local server on your p.c.,
    in the case of classic ASP IIS, and so having a virtual website.

    "infinite relevance" ?
    This whole tread is not important. Should NG threads be important?
    I don't. Why schould it substract?

    The felt sarcasm is only your opinion, not my intention.

    In discussion, showing obviousness is normal.

    What nonsene, so I should offend against Netiquette, by not using a proper
    signature, because you don't want to abide to it?

    Any good newsreader will automagically strip the signature, so using such
    help you to abide.
    Not so your Outlook Express, it seems,
    but then that is not a proper newsreader.
    Evertjan., Feb 13, 2010
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.