views:

149

answers:

2

I know this question has been asked many times, but my problem is a little different.

I have page which lets user download and upload excel file. During downloading excel, it takes approx 2 mins to generate the file. I have added checkpoints which updates the database with status like (started processing, working on header ...etc). I have done the same thing for upload.

I also have a ajax request which checks the database in fixed interval and prints status to user to give feedbacks like (started processing, working on header ...etc).

The problem is, i get the feedback only when the process is complete. It looks like the session is blocked during the background process and any other request(ajax) are only completed once the background process is over. ajax makes approx 10 requests within 4 sec intervals.I get the 10 response back only in the end.

I have tried two iframes and also frames, one running the ajax and other running the process, Doesn't work. i tried separate browser(Process running in IE, ajax running in FF) and that works (so i now my code works). Can anybody advise? Thanks

p.s. My environment is IIS 6, ASP.NET 3.5 with MVC 1.0 browser is IE6.0

+1  A: 

Your browser has a limitation on the number of connections that can be working concurrently.

I believe IE has a limitation of 2 connections. That means that even if you are running AJAX requests you can only have two requests running concurrently at the same time.

That is most likely why you're not seeing results until the end, because it's processing other connections and doesn't get to the status request until it's already done. That also explains why it works when you do it from different browsers, because you don't suffer from the same connection limitation.

Here's an article that details the issue.

Joseph
Thanks for the reply but I tried it Firefox too, and it has 15 connections and even this doesn't work.
spiderdevil
@spiderdevil Browsers aren't the only ones that put a limit on this. It's actually built into the HTTP 1.0 and 1.1 specs, so servers may also abide by the HTTP specs and their limitations, which is 4 simultaneous connections I believe.
Joseph
I checked with fiddler. and i see only two connections, my process and my ajax request is added in queue every two sec. once my process is over all ajax response come back.How do i solve this problem.
spiderdevil
A: 

This is exactly what i was looking for (asynchronous-processing-in-asp-net-mvc-with-ajax-progress-bar)

Using delegate BeginInvoke of IAsyncResult helped with the blocked session

spiderdevil