I am creating an Intranet webpage for my office.
The application needs to download SMTP email every 5 minutes. (As well as some other house keeping things)
I have just created a ASP.NET webpage that is running on IIS through Windows 2008 R2 server.
Do I have to create a seperate Windows Service to do this? So I would just have 2 programs, the webpage and the windows service?
or is there a better way to do it?
The idea
The simplest way to do recurring stuffs on an asp.net web site is
System.Timers.Timerobject and keep it reference on a static field in your code (to prevent garbage collection)Elapsedevent and put your recurring tasks thereThe code
About the app pool recycle
It does not matter:
If it’s really important, know that by default, an app pool is configured to recycle just once a day and to not stop even if there are no traffic.