I have an web application in MVC 3 and C#.
I need run a method every 1 hour for an unlimited time. I would like to know how to implemented it.
Thansk.
Related
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use a System.Timers.Timer. But please notice that implementing recurring background tasks in ASP.NET applications is a perilous task. Don’t forget that IIS could recycle the application pool at any time and under some circumstances (period of inactivity on the site, CPU/Memory thresholds are reached, …) bringing down all background tasks you might have started.
The correct way to do this is to implement it in another application. This could for example be a Windows Service or a simple Console Application scheduled to run at regular intervals with Windows Scheduler.