24hrs running service

I am using ASP.Net mvc 3 C# to make a web application. I have some service that needs to be running in an interval of x minutes. Also, some settings could be updated or changed for this service.

I am not sure, what technology i should use to keep my service running on the server and to be able to stop it/run it remotely using the ASP.Net MVC interface (web).

I assume some hidden service or application that has a timer to fire the required job every x minutes.

Any suggestions as it is my first big .Net project :)

Thank you


It depends on what control you have over the environment you deploy to. If it is your server and you have sufficient privileges over it, you can either:

  1. Write a Windows service that has a timer in it, which wakes up and executes an Http request on your web app.

  2. Set up a scheduled task that runs a VB script (or similar) to call your web app.

One thing I would not recommend doing is using a background thread in your web app that has a timer on it. You can do that (http://haacked.com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+haacked+%28you%27ve+been+HAACKED%29) but it is inherently unsafe if the web's app domain is brought down.

If you are deploying to an ISP, shared hosting, or for some reason you can only deploy your web app and nothing else, you will need to have a script that runs elsewhere that calls the web app. Most ISP's, even on shared hosting, will let you set up a scheduled task. You can then upload a simple VB script to cgi-bin, for example, which calls the web app (http://chriscant.phdcc.com/2011/05/scheduled-task-ping-for-plesk-in.html).

I am just about to implement the last solution myself.

You can use Quartz.NET as the site says "Quartz.NET is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems."

Need Your Help

Simple Library Questions (C++)

c++ gcc dynamic libraries shared

1. Are shared libraries and dynamic libraries the same exact thing?