Schedule task in ASP.NET

前端 未结 2 517
野性不改
野性不改 2020-12-07 04:43

I\'m trying to create a task scheduler that runs twice a day. I\'ve implemented a task scheduler using CacheItemRemovedCallaback, as suggested in this post and this blog. I

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 05:20

    I found solutions that mention Windows services or Windows task scheduler

    That's what you should be using. A web application doesn't "always run." It responds to requests, that's all. Unless something is actively making a request to the website, it's not doing anything.

    but that doesn't work for me since I need to be able to let the admin configure the times through the web application

    Sure it does. More than one application can share a single database. In this case you'd have two applications:

    • A Web Application where users can login and maintain the data related to the scheduled tasks.
    • A Windows Service (or scheduled Console Application) which runs in the background on the server and executes the configured tasks which it reads from the database.

提交回复
热议问题