I just started using AsyncController in my project to take care of some lengthy reports. It would seem ideal at the time when I could start the report, and then perform several other actions, waiting for it to return and fill the elements on the screen.
My controller looks something like this. I tried to use the thread to perform a long task that I hoped the controller would release to get more requests:
public class ReportsController : AsyncController { public void LongRunningActionAsync() { AsyncManager.OutstandingOperations.Increment(); var newThread = new Thread(LongTask); newThread.Start(); } private void LongTask() {
But what I find is that when I call LongRunningAction with a jQuery ajax request, any subsequent requests I make after that support it and are not processed until the LongRunningAction completes. For example, call LongRunningAction, which takes 10 seconds, and then call AnotherControllerAction, which is less than a second. AnotherControllerAction simply waits for the LongRunningAction to complete before returning the result.
I also checked jQuery code, but it is all the same if I specifically set "async: true":
$.ajax({ async: true, type: "POST", url: "/Reports.aspx/LongRunningAction", dataType: "html", success: function(data, textStatus, XMLHttpRequest) {
Right now, I just have to assume that I am using it incorrectly, but I hope one of you guys can clear my mental block!
javascript jquery c # asp.net-mvc-2
Jason May 28 '10 at 8:59 a.m. 2010-05-28 08:59
source share