Nikola Rasic
Nikola Rasic

Reputation: 75

Execute a method once a day, at a specific time, on a running server in .NET Core

I have a web api that's running 24/7 on LAN(due to data security reasons, it's not connected to the internet). I have to call one method inside it each morning around 07:00. I've read that Timers are not reliable. I do not own the server so I don't have access to the Task Scheduler. How can I achieve this?

Do you think I should tell them that I have to install the software? Would they let me use the Task Scheduler? Is there any way to do this without the Task Scheduler?

Upvotes: 2

Views: 4183

Answers (1)

Tiago Rios
Tiago Rios

Reputation: 283

There are a couple of options that you should look into.

  • Native .NET Core solution through IHostedService
  • Hangfire
    • Personally, I like that you can configure a dashboard and see what happened during the execution of your scheduled tasks.
  • As suggested by @Lei Yang in the comments, Quartz.NET

Hangfire is still adding in-memory support. Therefore, you're required to have a SQL Server to store all the information about the job (triggers, states, etc.).

This can have a huge impact in your decision. On the other hand, Quartz.NET does support in-memory store type.

Upvotes: 4

Related Questions