Skip to content

cdwaddell/AspBackgroundWorker

Repository files navigation

Titanosoft.AspBackgroundWorker

Build Status

What is AspBackgroundWorker?

AspBackgroundWorker is a dotnet Standard 2.0 library for scheduling a background job to periodically run inside of an ASP.NET core application.

How do I get started?

  1. install the nuget package:
PM> Install-Package Titanosoft.AspBackgroundWorker
  1. Configure logging however you wish. Read more about logging here: Logging in ASP.Net Core

  2. Configure your background job, by adding something like this to your confguration section (in Startup.cs):

app.UseBackgroundTask(new RecurringBackgroundTask(
    "NewTask",  //A unique name
    new TimeSpan(0,1,0), //Run every minute, 
    (serviceProvider, cancellationToken) => {
        //Your code that uses the service proveder and cancels when the cancellationtoken is cancelled
    }}
)
{
    RunImmediately = true //Run now or wait until the first scheduled instance
})

About

A dotnet Standard 2.0 library for scheduling a background job to periodically run inside of an ASP.NET core application.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages