Topshelf+Quartz实现windows任务

 

Topshelf使用示例,

HostFactory.Run(x =>
{
x.Service<QuartzStartup>(s =>
{

s.ConstructUsing(name => new QuartzStartup());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());

});
x.RunAsLocalSystem();
x.StartAutomatically();
x.SetDescription("MCE定时任务处理");
x.SetDisplayName("MCE定时任务处理");
x.SetServiceName("MCETask");
});

最后通过cmd 运行 service.exe(service是对应的dll名称) install

 

posted @ 2019-11-05 17:45  dongminglong  阅读(186)  评论(0编辑  收藏  举报