I've built this windows service which I ensured works locally. Now, although TopShelf's "ServiceName install" command's output indicates the install as successful, the service is nowhere to be found.
This is my service configuration code:
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();
});
Can you add this line and try:
servConfig.RunAsLocalSystem();
It magically fixed itself after some tries but there was definitely a permission warning windows event log having to do with "LocalSystem" so your suggestion might help too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.