[英]TopShelf Service Installation not working
我已經構建了這個 windows 服務,我確保它在本地工作。 現在,雖然 TopShelf 的“ServiceName install”命令的 output 指示安裝成功,但找不到該服務。
這是我的服務配置代碼:
HostFactory.Run(servConfig =>
{
servConfig.Service<TimerService>(servInst =>
{
servInst.ConstructUsing(
() => new TimerService());
servInst.WhenStarted(execute => execute.Start());
servInst.WhenStopped(execute => execute.Stop());
});
servConfig.SetServiceName("StayActiveService");
servConfig.SetDisplayName("Stay active service");
servConfig.SetDescription("Automatic timer setter");
servConfig.StartAutomatically();
});
您可以添加此行並嘗試:
servConfig.RunAsLocalSystem();
經過一些嘗試,它神奇地自行修復,但肯定有一個權限警告 windows 事件日志與“LocalSystem”有關,因此您的建議也可能有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.