public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseIpRateLimiting(); app.UseStaticFiles(); lifetime.ApplicationStarted.Register(UnRegService); GetContext.getInstance().ServiceProvider = app.ApplicationServices; getService(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); }
private void getService() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { var quartzStartup = (QuartzStartup)GetContext.getInstance().ServiceProvider.GetService(typeof(QuartzStartup)); quartzStartup.rds.Clear(); } }