With ASP.NET (as well as with old ASP)
requests for the same session are queued up. Meaning that second will not
execute until first one is done.
so probably it's not problem with AJAX, you just need to specify that pages
you return information with are Session-less (or HttpHandlers in your case).
George
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello all,
>
> I'm experiencing a problem with ASP.Net for which I can't find a
> reasonable explanation, or any information.
>
>
> I'm currently developing an application that, through AJAX, asks the
> server for updated information to show, and can also send information
> to the server.
> To do this, I have an XMLHttpRequest that queries an Asynchronous HTTP
> Handler (implementing IHttpAsyncHandler), which does not reply until
> there is actual information, or a time passes (30 seconds).
> In order to send information to the server, I open a second
> XMLHttpRequest and POST to another HTTP handler (this one is
> synchronous).
>
> Now, for this to work, both requests have to be simultaneous,
> obviously, but what i'm getting is that the second request (the one
> that POSTs) waits until the first one returns before sending, which
> makes the app completely unresponsive.
>
>
> Since I could think of a million things that could be going wrong here
> (like the Asynchronous handler doing something weird), I created a
> very simple test scenario to isolate the problem:
>
> 1) I created two synchronous (regular) HTTP handlers, that simply wait
> for 5 seconds, and then reply with "OK-1" or "OK-2" (depending on
> which one was queried).
> 2) In case I was forgetting something non-obvious (like implementing
> some interface), I also tried creating these two as Pages, instead of
> HTTP handlers, and I got exactly the same results.
> 3) I created a page which onLoad starts an XMLHttpRequest GET to the
> first handler, and once it's finished, it calls the same function
> again, creating a loop, which successfully outputs "OK-1" every 5
> seconds.
> 4) I added a button that starts another XMLHttpRequest GET to the
> second handler, only once (no loop)
>
> This is where the problem lies. When I press the button, it seems like
> requests are queued up. Once the first request comes back, after 5
> seconds the second comes back, and then after another 5 seconds the
> first one comes back again.
>
> To make sure the problem wasn't on the client, I tried this with both
> Firefox and IE, and I used 3 different ways of doing the Ajax call
> (Prototype, AJAXRequest, and manually). I also tried both from
> localhost, and from another computer in my network. All gave me the
> same results.
>
> Finally, if I implemented the 2 handlers on PHP (sorry for the
> blasphemy), this worked exactly as expected, so this must be something
> on the server, not on the client.
>
> Also, it's not something about "the server not responding
> simultaneously to two request from the same client" (which it
> shouldn't anyway), since if I open 2 browser windows, the "loops" in
> both work perfectly and simultaneously.
>
> What I don't get is what difference there is between doing the two
> requests from the same machine, and doing them from the same browser
> window. Like I said, it works with PHP on the server, so i'm not
> hitting the 2-connection limit on the client.
>
> I'm seriously stumped on this one (and quite desperate, to be honest),
> since if I can't fix this, the workaroung is looking PRETTY ugly
> (aborting the pending request, creating the POST, then resuming the
> loop, yuck...)
>
> I assume this is some feature hiding somewhere inside ??.config, but i
> can't find anything (i tried mindless things like setting debug=false,
> trace=false, and other desperate attempts with no luck)
>
> Any help, or pointers will be GREATLY appreciated!
>
> Thanks in advance
> Daniel Magliola
>