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