I\'m trying to implement a logic for my .NET MVC application where I would trigger scheduled tasks in my application on a following basis:
First scheduled ta
I had similar problem with my ASP.NET MVC App, I Wanted to do some works in special times and finally I could find a way. My solution was Plesk scheduels task feature, as where the most windows servers use plesk control panel You can publish your app on a windows server with plesk CP and create a new actionresualt in your MVC App and write Your codes that want to execute them in special times. By plesk scheduels tasks create a new task and call your Url with a cron that You made it, You can make many crons. If I Could not explain It very well You can search about Plesk Schedueled Tasks on the Internet, You can find many good answers.
You don't want to be performing long running and recurring background tasks in your web application for multiple reasons. You may go through the following blog post which outlines them very well.
I would recommend you moving this logic into a separate Windows Service or even a Console Application whose runs could be scheduled with the Windows Task Scheduler at the desired intervals.
The benefit of this is that you will be off-loading your web application from doing long running tasks which will be consuming precious resources from your webserver. Of course both the webserver and the worker service could share a common centralized datastore or messaging layer in order to communicate if necessary.
For scheduling tasks in ASP.NET MVC you have several options:
Be careful if you try to implement a custom solution yourself, as any exception in a thread not associated with a request would halt the entire process.
Visual Cron is a decent task scheduler you can use. We use it, calling service methods on our asp.net / mvc / webapi servers.
http://www.visualcron.com/