I have the following scenario:
I have an MVC Async Controller that has an upload action, which processes a csv file and saves the data to the database using nHibernate. This is called using
Task<Nacr.Core.Entities.FileLoad.Job>.Factory.StartNew(() =>
{
_fileUploadService.ProcessJob(job);
}
});
Currently the action is called thorugh an ajax call, and I am waiting for the ProcessJob to finish before sending back my response to the originating ajax call.
I am notifiying the user of the files progress using a signalR notifier hub to populate a record count and progress bar on the UI, which works a treat. Therefore is no need for the ajax call to wait for this to complete, as the results are visible during processing.
However, if I close the ajax call after I have started the processJob running, I get the following error:
System.ObjectDisposedException: Session is closed!
This is due to the fact that the Session is registered with a PerWebRequest lifestyle in Windsor, but my question is is there any way that the session can be used after the ajax call has had a response?
The reason for my question is that for very large files, the ajax request appears to be recalling the processJob after around a minute, presumably due to the fact that it has waited for too long without receiving a response for the original request.
My original question on this can be viewed here: Async Controller Action Re-Called after one minute
I think this is because the browser has not had a timely response from the MVC action and so automatically retries.
Look at the answer from this related question: What happens when no response is received for a request? I'm seeing retries
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.