I am working on asp.net mvc application that has one of the requirement as below.
Scenario : User submits a request to process long running task. The task will have to be initiated on the server side. And without waiting for the task to get completed, a response has to be sent to the user saying that once the task gets completed , they will get an email notification.
This seems to be a scenario for asynchronous processing. Initially I thought of using asynchronous delegates but came to know that asynchronous delegate will run as background thread and will not stay alive if the main thread exits.For me it seems , once the response is sent to the user, the main thread exits and so as background thread. Correct me if I am wrong on this.
So I thought of creating a foreground thread using Thread class. But in one of the articles I have read,it is mentioned that asp.net will not look at whether its a foreground thread or not and will not be useful. Is it true?
I am currently looking at the following atlernatives . Please suggest
Moving out the task processing logic outside of asp.net and put in console app/service and notify the app by pushing message from asp.net to MSMQ. Once the message is received,the console app will do the processing and send an email notification
A WCF service to receive the message and do the processing
Any other better ideas please share
Thanks,
Sveerap