尝试启动服务时,Topshelf窗口服务给出错误1053 [英] Topshelf window service giving Error 1053 when try to start the service
本文介绍了尝试启动服务时,Topshelf窗口服务给出错误1053的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用Topshelf开发了Windows服务。它在本地工作正常。当我部署测试并尝试启动该服务时,它给了我以下错误:
I have developed a windows service using Topshelf. it works fine locally. When i deployed to test and try to start the service, it is giving me the following error:
Error 1053: The service did not respond to the start or control request in a timely fashion.
测试服务器在Windows Server 2012上运行。
The test server is running on Windows server 2012.
这是我的服务启动和停止方法:
This is my service start and stop methods:
public void Start()
{
_logProvider.Info("Service started.");
StartScheduledJobs();
}
public void Stop()
{
_scheduler.Shutdown(true);
_logProvider.Info("Service stopped.");
}
private void StartScheduledJobs()
{
try
{
_scheduler.Start();
ScheduleDeleteJob();
}
catch (Exception ex)
{
_logProvider.Error("", ex);
}
}
有人可以帮助我吗?
谢谢
推荐答案
成功,我找到了一个解决方案,使用相同的错误消息解决了我的问题。
After trying every other solution without success I found a solution that solved my problem with the same error message.
public static int Main(string[] args)
{
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
//...
}
基于> https://github.com/Topshelf/Topshelf/issues/473
这篇关于尝试启动服务时,Topshelf窗口服务给出错误1053的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文