I would recommend looking at the BackgroundWorker class specified in the System.ComponentModel namespace.
The background worker provides the methods necessary for intensive work in a separate thread and receive status updates on it (via ReportProgress , ProgressChanged and RunWorkerCompleted ).
I personally personally experimented using BackgroundWorker in a web environment to run scheduled tasks. I decided to publish the work that I have done so far on Codeplex. I feel that the spirit of my code can be useful for your situation. Codeplex project for web-based task scheduler .
If you decide to download the project, you will see how I use the BackgroundWorker class in the ScheduledTaskRunner class. My implementation does not add progress events to employees, but it would be very easy to do so. In addition, my current implementation focuses on the task at a given interval, but changing it for most of the on-demand processing queue would not be very difficult. I can even add this as a function now that I think about it :)
Assuming you followed the approach to my code above, it would be easy to create an action on your controller that was fired to check the list of "tasks" (or the specific task that interests you), and report the information as a kind of ActionResult . Set up some javascript to poll the action for the specified interval, and you will have progress!
Good luck and let me know if you have questions about my code.
Nathan anderson
source share