简体   繁体   English

添加项目参考会阻止Windows服务启动-错误1053

[英]Adding project reference prevents windows service from starting - error 1053

I am writing a windows service that installs and runs successfully. 我正在写一个Windows服务,它可以成功安装并运行。

After I try to add a little sophistication to the service by referencing another project in my solution, when I try to start the service I get: 在尝试通过引用解决方案中的另一个项目为服务添加一些复杂性之后,当我尝试启动服务时,我得到:

Error 1053: The service did not respond to the start or control request in a timely fashion. 错误1053:服务未及时响应启动或控制请求。

The references which are homemade API's are .net 4.5 and the MS class libraries are 4.0. 自制API的引用是.net 4.5,MS类库是4.0。 Also, I have tried changing my build type to Release . 另外,我尝试将构建类型更改为Release

For what it's worth, the API's I'm trying to reference are using the Azure Service Bus. 对于它的价值,我尝试引用的API使用的是Azure Service Bus。 Also, we have quite a bit of dependency injection going on using ninject. 另外,我们使用ninject进行了很多依赖注入。

Any thoughts would be much appreciated. 任何想法将不胜感激。

If your service inherits from System.ServiceProcess.ServiceBase , which I'm assuming it does, try wrapping a console app around it to test the start up. 如果您的服务继承自System.ServiceProcess.ServiceBase ,我假设它继承了它,请尝试在其周围包装一个控制台应用程序以测试启动。

static void Main(string[] args)
{
    try
    {
        var myService = new MyService();
        myService.OnStart(args);
        Thread.Sleep(Timeout.Infinite);
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex);
    }
}

That might point to either a config or environment error that is being hidden by the service host. 这可能指向服务主机隐藏的配置或环境错误。

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

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