Background Processing/Thread in ASP.NET App, how to keep them running?
-
Does anyone have any advice regarding running a background processes or threads in an ASP.NET application. I know it's possible to kick off a background process by responding to Application_Start events in the Global.asax file and using some sort of singleton class. I basically want a task scheduller that kicks off at a certain time without any user intervention and sends emails, or writes to a database etc. The main issue I have is how to keep it running because the ASP.NET AppDomain can get reset or shutdown for a number of reasons, such as when there's no user activity. So my main question is how could I keep it running? I read somewhere someone suggesting getting the background process to do an HttpWebRequest it's own website, thus keeping the AppDomain running, would this work do you think? Also I know about running a Windows Service, but since I'm on shared hosting this isn't an option. Many thanks for your help! :)
Dominic Pettifer Blog: www.dominicpettifer.co.uk