A frequent requirement for ASP.NET developers is to schedule tasks at regular intervals. This can include site maintenance tasks, like cleaning up old files, emailing newsletters on a schedule etc. This article examines one easy option for managing tasks like these without having to configure external tools, and discusses a couple of alternatives.
Simulate a Windows Service using ASP.NET to run scheduled jobs By Omar Al Zabir
How to run scheduled jobs from ASP.NET without requiring a Windows Service to be installed on the server? Very often we need to run some maintenance tasks or scheduled tasks like sending reminder emails to users from our websites. This can only be achieved using a Windows service. ASP.NET being stateless provides no support to run some code continuously or to run code at a scheduled time. As a result, we have to make our own Windows Services in order to run scheduled jobs or cron jobs. But in a shared hosted environment, we do not always have the luxury to deploy our own Windows service to our hosting provider�s web server. We either have to buy a dedicated server which is very costly, or sacrifice such features in our web solution. However, running a scheduled task is a very handy feature especially for sending reminder emails to users, maintenance reports to administrators, or run cleanup operations etc. So, I will show you a tricky way to run scheduled jobs using pure ASP.NET without requiring any Windows service. This solution runs on any hosting service providing just ASP.NET hosting. As a result, you can have the scheduled job feature in your ASP.NET web projects without buying dedicated servers.
Hope this helps