简体   繁体   English

Windows服务无法在Windows 10上启动

[英]Windows service failed to start on Windows 10

I have a windows service built using .NET 4.5 and topshelf library running under LocalSystem account.The service is configured to start automatically on system reboot. 我有一个使用.NET 4.5和topshelf库构建的Windows服务,该服务在LocalSystem帐户下运行。该服务配置为在系统重新启动时自动启动。 When the service starts it reads information from a custom configuration file(json file) which is located at 'C:\\ProgramData' for configuration information.I have tested this configuration on my local PC(Windows 7) and verified the setup works without issues. 当服务启动时,它会从位于“ C:\\ ProgramData”的自定义配置文件(json文件)中读取信息以获取配置信息。我已经在本地PC(Windows 7)上测试了此配置,并验证了设置是否可以正常工作。 Lately i attempted to install this service on a windows service on few windows 10 machines and some of them fail to start the windows service on startup.I looked at the event viewer and can see "The service did not respond in a timely fashion". 最近,我尝试在几台Windows 10计算机上的Windows服务上安装此服务,其中一些在启动时无法启动Windows服务。我查看了事件查看器,可以看到“该服务未及时响应”。 I am able to start the service manually later just fine later. 稍后我可以手动启动该服务。 I have put the logic to read from the configuration on Start method inside Task.Run for the Start method to return quickly. 我已将逻辑从Task.Run内Start方法的配置中读取,以使Start方法快速返回。 Please advice what else i need to take into consideration to fix this issue. 请提出其他需要解决的问题。

For anyone struggling with this issue,we have had the same exact issue on some of the slower windows 10 machines. 对于在此问题上苦苦挣扎的任何人,我们在某些速度较慢的Windows 10计算机上都遇到了同样的问题。 We were able to solve this issue by setting generatePublisherEvidence to false in the config file. 我们可以通过在配置文件中将generatePublisherEvidence设置为false来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM