当我在配置中继续添加时,Topshelf 不起作用。它适用于启动和停止方法。我在 continue 方法中没有任何代码会阻止它运行(简单的 console.writeline )
HostFactory.Run(x =>
{
x.SetDescription("Data Service - POC");
x.SetDisplayName("Data Service");
x.SetServiceName("DataService");
x.EnablePauseAndContinue();
x.Service<SampleService>(s =>
{
s.ConstructUsing(() => new SampleService());
s.WhenStarted(v => v.Start());
s.WhenStopped(v => v.Stop());
// s.WhenContinued(v => v.Continue());
});
x.RunAsLocalSystem();
});
我错过了什么?
它编译得很好。它没有调用我的任何方法。我看到控制台闪烁并消失。我什至无法阅读该控制台上的内容。如果我注释掉 s.WhenContinued(v => v.Continue()); 它工作正常