create background task using .netcore 1

47 views Asked by At

I need to create a service to do a daily task . and I need to do it with .net core 1 . is there anybody here to tell me how can I do it ?the issue is that I have to use .net core 1.

1

There are 1 answers

1
James Woodall On

Hangfire (https://www.hangfire.io) is an excellent tool to create background tasks.

You'll need some kind of storage (SQL, MongoDB) to keep track of the tasks but once it is implemented, you can create recurring background jobs like this:

RecurringJob.AddOrUpdate(
    () => Console.WriteLine("Recurring!"),
    Cron.Daily);

I don't know if the latest version of Hangfire will support .NET Core 1, but older versions certainly will.