简体   繁体   中英

Cron or scheduled task for asp.net webapp

I have a web application C# asp.net MVC.

I have to change a DB value and send a mail at the same time every day (this hour may be changed via administration interface so the time have to be in database).

What is the best?

  1. Create an executable program and do cron task on win server that verify every minute the value of the hour in database and if it is time do the work.

  2. Use scheduled task? But how to do this?

Thanks for your help

Creating windows service for scheduled task on the windows is another solution and I prefer it because Windows service doesn't need to have anyone logged in, and Windows has facilities for stopping, starting, and logging the service results. You can create interface in your project for managing your windows service. Another solution is using third party like HangFire which is provide an easy way to perform background processing in .NET and .NET Core applications. No Windows Service or separate process required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM