Quartz.AspNetCore
4.0.0-alpha.1
Prefix Reserved
dotnet add package Quartz.AspNetCore --version 4.0.0-alpha.1
NuGet\Install-Package Quartz.AspNetCore -Version 4.0.0-alpha.1
<PackageReference Include="Quartz.AspNetCore" Version="4.0.0-alpha.1" />
<PackageVersion Include="Quartz.AspNetCore" Version="4.0.0-alpha.1" />
<PackageReference Include="Quartz.AspNetCore" />
paket add Quartz.AspNetCore --version 4.0.0-alpha.1
#r "nuget: Quartz.AspNetCore, 4.0.0-alpha.1"
#:package Quartz.AspNetCore@4.0.0-alpha.1
#addin nuget:?package=Quartz.AspNetCore&version=4.0.0-alpha.1&prerelease
#tool nuget:?package=Quartz.AspNetCore&version=4.0.0-alpha.1&prerelease
title: ASP.NET Core Integration
Quartz.AspNetCore provides integration with ASP.NET Core hosted services.
::: tip If you only need the generic host, generic host integration might suffice. :::
Installation
You need to add NuGet package reference to your project which uses Quartz.
dotnet add package Quartz.AspNetCore
Using
You can host the scheduler by invoking AddQuartzHostedService on the web application builder.
This adds a hosted Quartz server into the ASP.NET Core process that is started and stopped based on the application's lifetime.
::: tip
AddQuartzHostedService lives in the core Quartz package. Quartz 3's AddQuartzServer, which registered the
hosted service and a health check together, is gone — call AddQuartzHealthChecks for the health check.
:::
::: tip See Quartz documentation to learn more about configuring Quartz scheduler, jobs and triggers. :::
Example Program.cs configuration
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.AddQuartz(q =>
{
// base Quartz scheduler, job and trigger configuration
});
// ASP.NET Core hosting
builder.AddQuartzHostedService(options =>
{
// when shutting down we want jobs to complete gracefully
options.WaitForJobsToComplete = true;
});
WebApplication app = builder.Build();
A practical example of the setup
In the code below you can see a real application of the Quartz package within ASP.NET Core MVC.
To better illustrate the use of the Quartz library, imagine you have a Program.cs file that is always created when you choose the MVC architecture, and then imagine a Jobs folder where you have all the tasks you want Quartz to perform in the background when you run your web application.
After that, it's pretty straightforward.
In the Jobs folder, you create a class that will perform the tasks you specify.
The class should extend the IJob interface and implement the Execute method.
Example SendEmailJob.cs configuration
public sealed class SendEmailJob : IJob
{
private readonly IEmailSender sender;
public SendEmailJob(IEmailSender sender)
{
this.sender = sender;
}
public ValueTask Execute(IJobExecutionContext context, CancellationToken cancellationToken = default)
{
// Code that sends a periodic email to the user (for example)
return sender.SendDigest(cancellationToken);
}
}
A job whose work is asynchronous is written async ValueTask as usual. One that only forwards a call, like
this one, can return it directly and skip the state machine; one with nothing to await at all returns
default, which is a completed ValueTask that allocates nothing. What a job must not do is block: the
scheduler is holding a worker slot for it.
After that, you just need to build Quartz trigger in Program.cs, which guarantees that the job will run according to the preset interval.
Example Program.cs configuration
builder.AddQuartz(q =>
{
// Just use the name of your job that you created in the Jobs folder.
JobKey jobKey = new("SendEmailJob");
q.AddJob<SendEmailJob>(opts => opts.WithIdentity(jobKey));
q.AddTrigger<SendEmailJob>(opts => opts
.ForJob(jobKey)
.WithIdentity("SendEmailJob-trigger")
// This Cron interval can be described as "run every minute" (when second is zero)
.WithCronSchedule("0 * * ? * *"));
});
builder.AddQuartzHostedService(options => options.WaitForJobsToComplete = true);
For more on cron triggers see the CronTriggers lesson, and for the expression syntax itself the Cron Expression Reference.
Health checks
Quartz registers an ASP.NET Core health check that reports unhealthy when the scheduler is not running or cannot reach its store. Add it alongside your application's other checks:
builder.Services.AddHealthChecks()
.AddSqlServer(connectionString)
.AddQuartz();
services.AddQuartzHealthChecks() is the same thing for an application that has no other checks to
compose with.
The registration can be customized via the optional configuration callback, for example to attach tags so the check can be filtered into separate liveness and readiness probes:
builder.Services.AddHealthChecks().AddQuartz(options =>
{
options.Name = "quartz-scheduler"; // the default, or quartz-scheduler-<name> for a named scheduler
options.Tags.AddRange(["ready", "live"]);
options.FailureStatus = HealthStatus.Unhealthy;
});
The callback is one source of QuartzHealthCheckOptions among several: the settings go through the
options pipeline, so services.Configure<QuartzHealthCheckOptions>(...) and a bound configuration
section mean the same thing, whichever order they are written in.
A named scheduler has a check of its own, reporting on its scheduler. Name it on the health checks
builder, or ask for one from inside AddQuartz:
builder.Services.AddHealthChecks().AddQuartz("reporting", options => options.Tags.Add("ready"));
// or, where the scheduler is configured
builder.Services.AddQuartz("reporting", q => q.AddQuartzHealthChecks());
Its options are that scheduler's, so they are configured under its name:
builder.Services.Configure<QuartzHealthCheckOptions>("reporting", options => options.Tags.Add("ready"));
app.MapHealthChecks("/healthz/ready", new HealthCheckOptions
{
Predicate = registration => registration.Tags.Contains("ready")
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Quartz (>= 4.0.0-alpha.1)
NuGet packages (82)
Showing the top 5 NuGet packages that depend on Quartz.AspNetCore:
| Package | Downloads |
|---|---|
|
WasmAI.AutoGenerator
is a powerful code-generation library for .NET 8 that automates the scaffolding of backend components like models, services, controllers, and more—based on a flexible folder configuration. |
|
|
CucurbIT.Infrastructure.Jobs
Package Description |
|
|
SK.Cluster.Job
SK.Cluster框架定时任务作业 |
|
|
RapidFire.Core
Rapid Fire For WEB with .NET 6! |
|
|
TJC.Cyclops.TaskSystem
企服版任务核心 |
GitHub repositories (19)
Showing the top 19 popular GitHub repositories that depend on Quartz.AspNetCore:
| Repository | Stars |
|---|---|
|
RayWangQvQ/BiliBiliToolPro
B 站(bilibili)自动任务工具,支持docker、青龙、k8s等多种部署方式。全面拥抱AI。敏感肌也能用。
|
|
|
dotnetcore/DotnetSpider
DotnetSpider, a .NET standard web crawling library. It is lightweight, efficient and fast high-level web crawling & scraping framework
|
|
|
lampo1024/DncZeus
DncZeus 是一个基于.NET 7 + Vue.js(iview-admin) 的前后端分离的通用后台权限(页面访问、操作按钮控制)管理系统框架。后端使用.NET 7 + EF Core构建,UI则是目前流行的基于Vue.js的iView(iview-admin)。项目实现了前后端的动态权限管理和控制以及基于JWT的用户令牌认证机制,让前后端的交互更流畅。码云镜像:https://gitee.com/rector/DncZeus 。演示地址(demo):
|
|
|
IoTSharp/IoTSharp
IoTSharp is an open-source IoT platform for data collection, processing, visualization, and device management.
|
|
|
streetwriters/notesnook-sync-server
Sync server for Notesnook (self-hosting in alpha)
|
|
|
mixcore/mix.core
🚀 A future-proof enterprise web CMS supporting both headless and decoupled approaches. Build any type of app with customizable APIs on ASP.NET Core/.NET Core. Completely open-source and designed for flexibility. Since 2018.
|
|
|
ntxinh/AspNetCore-DDD
Full ASP.NET Core 10.0 LTS application with DDD, CQRS and Event Sourcing
|
|
|
teelur/budget-board
A simple app for tracking monthly spending and working towards financial goals.
|
|
|
Implem/Implem.Pleasanter
Pleasanter is a no-code/low-code development platform that runs on .NET. You can quickly create business applications with simple operations.
|
|
|
foxminchan/BookWorm
The practical implementation of Aspire using Microservices, AI-Agents
|
|
|
poppastring/dasblog-core
The original DasBlog reimagined with ASP.NET Core
|
|
|
withsalt/BilibiliLiveTools
Bilibili(B站)无人值守直播工具。自动登录,自动获取直播推流地址,自动推流(使用ffmpeg),可以用于电脑、树莓派等设备无人值守直播。
|
|
|
axzxs2001/Asp.NetCoreExperiment
原来所有项目都移动到**OleVersion**目录下进行保留。新的案例装以.net 5.0为主,一部分对以前案例进行升级,一部分将以前的工作经验总结出来,以供大家参考!
|
|
|
uyoufu/UZonMail
宇正群邮是一款开源的邮件群发软件,提供邮件群发、邮件营销(EDM)、邮箱采集、任意变量、AI 生成、多线程并发等功能。支持所有类型邮箱账号。原生企业级品质,支持多端用户,支持Windows、Linux、MacOS等操作系统, 支持服务器部署。已在外贸营销、教育培训、财务会计等多个行业广泛使用。 UZonMail is an open-source, enterprise‑grade bulk email and mass‑mailing platform designed for high‑volume EDM and email marketing campaigns. Widely adopted in industries such as education and finance
|
|
|
jianzhichu/dysync.net
视频同步工具
|
|
|
chr233/XinjingdailyBot
Telegram投稿机器人,支持多图与权限管理
|
|
|
bingbing-gui/dotnet-agent-playbook
一个面向 .NET + AI Agent 开发的实践型仓库,涵盖 Web、云原生与微服务场景,聚焦智能应用的工程化落地。
|
|
|
moonheart/mementomori-helper
メメントモリ MementoMori 游戏助手 Game Assistant ゲームアシスタント
|
|
|
surveysolutions/surveysolutions
Survey Solutions is a survey management and data collection system developed by the World Bank.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0-alpha.1 | 53 | 8/22/2026 |
| 3.19.1 | 74,041 | 7/26/2026 |
| 3.19.0 | 21,685 | 7/24/2026 |
| 3.18.2 | 140,386 | 6/27/2026 |
| 3.18.1 | 421,131 | 4/25/2026 |
| 3.18.0 | 133,318 | 4/11/2026 |
| 3.17.1 | 56,057 | 4/3/2026 |
| 3.17.0 | 67,126 | 3/29/2026 |
| 3.16.1 | 190,452 | 3/4/2026 |
| 3.16.0 | 2,400,210 | 3/1/2026 |
| 3.15.1 | 1,281,115 | 10/26/2025 |
| 3.15.0 | 834,500 | 8/3/2025 |
| 3.14.0 | 2,048,829 | 3/8/2025 |
| 3.13.1 | 6,126,485 | 11/2/2024 |
| 3.13.0 | 1,700,566 | 8/10/2024 |
| 3.12.0 | 132,978 | 8/3/2024 |
| 3.11.0 | 741,754 | 7/7/2024 |
| 3.10.0 | 177,604 | 6/26/2024 |
| 3.9.0 | 700,662 | 5/9/2024 |
| 3.8.1 | 1,509,323 | 2/17/2024 |