I have a ASP.NET Web App. I notice that while a simple ajax call(see below) is in process, web application does not respond to any action that I try on a different browser.
$.ajax({
type: "GET",
async: true,
url: "someurl",
dataType: "text",
cache: false,
success: function(msg){
CheckResponse(msg);
}
});
This happens when I open two firefox or two IE. I run the function that does the ajax call on first browser and till the response of the ajax is returned, I cannot do anything on the second browser on the same site. No breakpoints are hit on the server from the second browser till initial ajax is completed. It hangs for any click etc..
The hang on the second browser ends immediately after the ajax call is completed on the first one.
This behavior is not observed if I try the same on IE and Firefox side by side. Only happen with IE & IE or FF & FF side by side
Appreciate if you can help me see what I am missing here.
It sounds like Apache (or whatever webserver you have running) only processes one request per client at a time. When processing your Ajax request, Apache queues all other requests coming from the same client.
Also, when using two different browsers, your server sees each browser as a different client, meaning it will process one request per browser. I don't know exactly what information is used to identify a client (my guess would be IP address + browser version, but I could be horribly wrong here)
Someone else might be able to tell you how to configure Apache to work around this problem; unfortunately I don't know this myself. The problem does not lie with Javascript / Ajax however; it is a limitation imposed by the server, not the client.
"someurl" is blocking on the server until the first request completes for any given session. The problem does not manifest when you have totally separate browsers because in that scenario there are two separate ASP.NET sessions. By design, ASP.NET performs request queuing when the same client makes multiple requests for resources that are configured to be able to write to the Session (the default for Pages). Based on your description, this is what is going on.
Solution:
EnableSessionState="false"
or
EnableSessionState="ReadOnly"
to the @ Page
directive.IRequiresSessionState
or replacing it with IReadOnlySessionState
.[SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With