1

I am using .NET 6.0, and I am using Quartz.Net to schedule a event at a specific time.

I am using this: Tutorial

But in the end I need to configure in startup class inside the ConfigureServices method - like this:

// Add Quartz services
services.AddHostedService<QuartzHostedService>();
services.AddSingleton<IJobFactory, SingletonJobFactory>();
services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();

// Add our job
services.AddSingleton<RemindersJob>();
services.AddSingleton(new JobSchedule(
    jobType: typeof(RemindersJob),
    cronExpression: "0 0/5 * 1/1 * ? *")); // run every 5 min

But the startup class is not there in my project, so how should I configure this?

1

2 Answers 2

1

The tutorial you are looking at is probably .NET Core 5. In .NET 6 you need to configure in Program.cs and change this:

services.AddScoped<IJobFactory, SingletonJobFactory>();
services.AddScoped<ISchedulerFactory, StdSchedulerFactory>();

insted of this:

services.AddSingleton<IJobFactory, SingletonJobFactory>();
services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
Sign up to request clarification or add additional context in comments.

Comments

0

You need to configure in Program.cs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.