[英]Schedule to run a method Daily 8 AM in ASP.NET MVC
如何在 ASP.NET MVC 中调用方法例如,在一个方法中,带出一个出生的人的列表,并向他们发送祝贺信息。
There is no code provided but generally, there are several options I could think of:没有提供代码,但一般来说,我能想到几个选项:
BackgroundService
BackgroundService
you can create a structure like this in the backgroundservice:您可以在后台服务中创建这样的结构:
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
//Do work
await Task.Delay(timeSpan, stoppingToken);
}
}
Quartz
task scheduler, which might be overkill for your task. Quartz
任务调度程序,这对你的任务来说可能有点矫枉过正。
https://www.quartz-scheduler.net/ https://www.quartz-scheduler.net/
A long-running timer (not recommended)长时间运行的计时器(不推荐)
Windows Task Scheduler Task on the Server, triggering an API Method.服务器上的 Windows 任务计划程序任务,触发 API 方法。
(Suggested by Fildor ) (由菲尔多推荐)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.