Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.Net: IHttpAsyncHandler and IRequiresSessionState not working
    text
    copied!<p>I have implemented an IHttpAsyncHandler. I am making about 5 different AJAX calls from a webpage that has widgets to that handler. </p> <p>One of those widgets takes about 15 seconds to load(because of a large database query) the others should all load in under a second. The handler is responding in a synchronous manner.</p> <p>I am getting very inconsistent results. The ProcessRequest method is using Session and other class level variables. <strong>Could that be causing different requests to use the same thread instead each there own?</strong> </p> <p>I'm getting this...</p> <p>Request1 ---> response 1 sec<br> Request2 ---> response 14 sec<br> Request3 ---> response 14.5 sec<br> Request4 ---> response 15 sec<br> Request5 ---> response 15.5 sec<br></p> <p>but I'm looking for something more like this...</p> <p>Request1 ---> response 1 sec<br> Request2 ---> response 14 sec<br> Request3 ---> response 1.5 sec<br> Request4 ---> response 2 sec<br> Request5 ---> response 1.5 sec<br></p> <p>Without posting too much code my implementation of the IHttpAsyncHandler methods are pretty standard.</p> <pre><code>private AsyncProcessorDelegate _Delegate; protected delegate void AsyncProcessorDelegate(HttpContext context); IAsyncResult IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { _Delegate = new AsyncProcessorDelegate(ProcessRequest); return _Delegate.BeginInvoke(context, cb, extraData); } void IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) { _Delegate.EndInvoke(result); } </code></pre> <p>Putting a debug break point in my IHttpAsyncHandler.BeginProcessRequest method I can see that the method isn't being fired until the last Process is complete.</p> <p>Also my machine.config has this entry... processModel autoConfig="true" with no other properties set.</p> <p>I'm calling the handler like this...<br> $.ajax( { type: "GET", url: "../HTML/HtmlHandler.ashx", cache: true, dataType: "text", data: { html: name }, success: function(html) { //$(function() { //console.log(tabname); //console.log("msg:" + msg); $("#" + name + "holder").html(html); //checkAllLoaded(); ClientHome_init(''); //}); },</p> <pre><code> error: function(XMLHttpRequest, textStatus, errorThrown) { $("#" + name + "holder").html("&lt;span&gt;Error retrieving widget.&lt;/span&gt;"); //console.log("error:" + tabname); //checkAllLoaded(); } } </code></pre> <p><strong>What else do I need to check for?</strong> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload