Service 当我使用topshelf服务时,如何停止或暂停Quartz.Net?

Service 当我使用topshelf服务时,如何停止或暂停Quartz.Net?,service,quartz.net,topshelf,Service,Quartz.net,Topshelf,暂停topshelf服务时,如何停止或暂停Quartz.Net 目前,在所有示例中,-注册在启动/停止方法之外: factory.Service<IServiceHost>(sc => { sc.ConstructUsing(s => new ServiceHost()); sc.WhenStarted((s, host) => s.Start(host)); sc.WhenStopped(s => s.Stop()); sc.WhenPaus

暂停topshelf服务时,如何停止或暂停Quartz.Net

目前,在所有示例中,-注册在启动/停止方法之外:

factory.Service<IServiceHost>(sc =>
{
  sc.ConstructUsing(s => new ServiceHost());
  sc.WhenStarted((s, host) => s.Start(host));
  sc.WhenStopped(s => s.Stop());
  sc.WhenPaused(s => s.Pause());
  sc.WhenContinued(s => s.Continue());

  sc.ScheduleQuartzJob(...)
}
工厂服务(sc=>
{
sc.ConstructUsing(s=>newServiceHost());
sc.WhenStarted((s,host)=>s.Start(host));
sc.停止时(s=>s.停止());
sc.whenpause(s=>s.Pause());
sc.whencontinue(s=>s.Continue());
sc.ScheduleQuartzJob(…)
}
Program.cs

        HostFactory.Run(factory =>
        {
            factory.UseNLog();
            factory.UseAutofacContainer(Container);
            factory.Service<ServiceHost>(service =>
            {
                service.ConstructUsingAutofacContainer();
                service.WhenStarted((sc, hc) => sc.Start(hc));
                service.WhenStopped((sc, hc) =>
                {
                    Container.Dispose();
                    return sc.Stop(hc);
                });

                service.ScheduleQuartzJob(cfg => JobConfigurator.GetConfigurationForJob<DataImportJob>(cfg, Settings.Default.RecurrentTimeout));

                factory.RunAsLocalSystem().StartAutomaticallyDelayed().EnableServiceRecovery(sr =>
            {
                sr.OnCrashOnly();
                sr.RestartService(0);
                sr.SetResetPeriod(1);
            }).EnableShutdown();
        });
Program.cs

        HostFactory.Run(factory =>
        {
            factory.UseNLog();
            factory.UseAutofacContainer(Container);
            factory.Service<ServiceHost>(service =>
            {
                service.ConstructUsingAutofacContainer();
                service.WhenStarted((sc, hc) => sc.Start(hc));
                service.WhenStopped((sc, hc) =>
                {
                    Container.Dispose();
                    return sc.Stop(hc);
                });

                service.ScheduleQuartzJob(cfg => JobConfigurator.GetConfigurationForJob<DataImportJob>(cfg, Settings.Default.RecurrentTimeout));

                factory.RunAsLocalSystem().StartAutomaticallyDelayed().EnableServiceRecovery(sr =>
            {
                sr.OnCrashOnly();
                sr.RestartService(0);
                sr.SetResetPeriod(1);
            }).EnableShutdown();
        });

什么反对调度器.Shutdown()?什么反对调度器.Shutdown()?