I am trying to implement functionality where SQL Server has a stored procedure that must be called from an ASP MVC application and processed in the background (it may take a lot of time because it calls a remote remote remote procedure to process the Excel file stored on the server). But the response of the last HTTP request should be returned to the client, so the user interface will not hang waiting for processing.
I tried so many different ways, but the user interface is still not responding immediately.
I tried BackgroundWorker , but this did not allow the main thread to respond to the client before it was completed, I also tried:
Thread.QueueUserWorkItem(delegate {
It still does not return a response, and HttpContext.Current not available in the background thread.
Perhaps there is a way to start background processing, pause it so that the main thread can return a response to the browser, and then resume the background thread so that all processing with calls to the stored procedure?
Did I miss something?
Can someone please let me know how I can solve this problem? It would be very grateful.
multithreading c # asp.net-mvc
Paul
source share