启动Windows服务失败并显示错误1053 [英] Starting a windows service fails with error 1053

查看:2209
本文介绍了启动Windows服务失败并显示错误1053的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows服务无法启动,出现错误错误1053:该服务未及时响应启动或控制请求。

I have a windows service that is failing to start, giving an error "Error 1053: The service did not respond to the start or control request in a timely fashion".

在调试器中运行服务正常,如果双击远程计算机上的服务.exe,则会弹出一个控制台窗口,并且可以继续正常运行-我什至可以看到显示该程序的日志消息正在按照应有的方式处理一切。

Running the service in my debugger works fine, and if I double click on the the service .exe on the remote machine a console window pops up and continues to run without problem - I can even see log messages showing me that the program is processing everything the way it should be.

该服务以前运行良好,尽管这是我个人第一次尝试使用对该程序进行的最新更改来部署它。我已经评估了这些更改,无法弄清它们是如何引起此问题的,特别是因为当不作为服务启动时,一切运行正常。

The service had been running fine previously, though this is my first time, personally, trying to deploy it with the most recent changes made to the program. I've evaluated those changes and cant figure out how they might cause this problem, particuarly since everything runs fine when not started as a service.

StartRoutine()方法服务内容为空,因此应以及时的方式返回。

The StartRoutine() method of the service impelmentation is empty, so should be returning in a "timely fashion".

我已经在计算机上检查了事件日志,除了30秒钟没有从服务中得到回音,它没有提供任何其他信息。

I've checked the event logs on the computer, and it doesn't give any additional information other than it didn't hear back from the service in the 30 second requisite time frame.

由于它可以在我的计算机上运行,​​并且作为双击的可执行文件,我将如何确定为什么它作为服务失败?

Since it works on my machine, and as a double-clicked executable, how would I go about figuring out why it fails as a service?

哦,它是.NET 2.0,因此它不应该受到表现出这种症状的1.1框架错误的影响( http://support.microsoft.com/kb/839174

Oh, and it's .NET 2.0, so it shouldn't be affected by the 1.1 framework bug that exhibited this symptom (http://support.microsoft.com/kb/839174)

该框是一个运行SP2的Windows Server 2003 R2计算机。

The box is a windows server 2003 R2 machine running SP2.

推荐答案

可能有很多问题,这可能有助于获取堆栈跟踪。机器出现问题。有多种方法可以执行此操作,但要点是必须在代码中查看失败的地方。

Could be a number of things and it might help to get a stack trace on the machine exhibiting the problem. There are a number of ways to do this but the point is that you have to see where this is failing in the code.

您可以使用远程调试,但是一个简单的事情可能只是登录事件记录器,或者文件记录器(如果有)。从字面上看,将 WriteLine( At class :: function())遍及代码的各个部分,以查看您是否到达了那里。

You can do this with remote debugging, but a simple thing might be to just log to the event logger, or file log if you have that. Literally, putting "WriteLine("At class::function()") throughout portions of the code to see if you've made it there.

至少让您朝正确的方向看(最终就是代码)。

This will at least get you looking in the right direction (which ultimately is the code).

更新

有关使用WinDbg解决启动问题的详细信息,请参见Microsoft的如何调试Windows服务文章。

See Microsoft's How to Debug Windows Services article for details in troubleshooting startup problems using WinDbg.

相关问题详细介绍了调试用.NET编写的服务的好方法。

This related question details nice ways to debug services that are written in .NET.

这篇关于启动Windows服务失败并显示错误1053的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆