I’m running an MVC 3 application on a shared hosting and there are a few pages which require a lot of processing that shouldn’t keep the user waiting. (Examples: sending a few hundred mails with attachments, creating several thousand records in a database.)
Now I’m not asking how to achieve this, because I know how, what I would like to know is. Is there a risk of my application stopping if it’s performing an operation for say… 60 seconds?
If so, what can you do to prevent it (knowing that the application cannot run in full trust)?
I’ve used Task for this, something like
One problem I ran into was I was naively passing the request object through to the task. Don’t do this, instead copy out the bits you need and pass those down, as, by the time you could to use the request object the pipeline may have disposed it.