RLib RLib - 10 months ago 179
ASP.NET (C#) Question

How to use Quartz.NET with ASP.NET Core Web Application?

In traditional

application, we (re-)intialize the
scheduler in the
handler in
But I have no ideas where to write the code for scheduling jobs as there isn't
Core Web application
Should I put the code in

Set Set
Answer Source

You may use ConfigureServices or Configure methods. Although Configure method is mainly used to configure the HTTP request pipeline, the benefit is that you directly can use IHostingEnvironment (and so get configuration settings) and ILoggerFactory interfaces. And using ConfigureServices method those dependencies may be accessed if you create corresponding properties in Startup class.

// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)