Reputation: 873
how Call Method in ASP.NET MVC For example, in one method, bring out a list of people who are born and send them a congratulatory message.
Upvotes: 5
Views: 2149
Reputation: 1933
There is no code provided but generally, there are several options I could think of:
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.
https://www.quartz-scheduler.net/
A long-running timer (not recommended)
Windows Task Scheduler Task on the Server, triggering an API Method.
(Suggested by Fildor)
Upvotes: 5