Quartz.Extensions.Hostingopen in new window provides integration with hosted servicesopen in new window.


You can add Quartz configuration by invoking an extension method AddQuartzHostedService on IServiceCollection. This will add a hosted Quartz server into process that will be started and stopped based on applications lifetime.


See Quartz.Extensions.DependencyInjection documentation to learn more about configuring Quartz scheduler, jobs and triggers.

Example program utilizing hosted services configuration

public class Program
    public static void Main(string[] args)
        Log.Logger = new LoggerConfiguration()

    public static IHostBuilder CreateHostBuilder(string[] args) =>
            .ConfigureServices((hostContext, services) =>
                // see Quartz.Extensions.DependencyInjection documentation about how to configure different configuration aspects
                services.AddQuartz(q =>
                    // your configuration here

                // Quartz.Extensions.Hosting hosting
                services.AddQuartzHostedService(options =>
                    // when shutting down we want jobs to complete gracefully
                    options.WaitForJobsToComplete = true;