无法调试Windows服务.. [英] Unable to debug windows service..
问题描述
我正在使用WIN 7 OS和VS 2003.我从远程服务器下载了一个Windows服务项目,并成功安装在我的使用installutil.exe的系统。我现在可以开始和停止服务了。但我无法调试该服务。我试过Debug - >流程 - >连接。即使这样我也会收到以下错误。
Windows服务启动失败
无法启动服务从命令行或调试器。必须首先安装Windows服务(使用installutil.exe),然后使用服务器资源管理器,Windows服务管理工具或NET START命令启动。
我想在onStart()方法中插入一个断点来理解程序逻辑。我是.NET的初学者。
你能帮我调试一下这个服务吗?
提前致谢..
Vanathi
Hi,
I'm using WIN 7 OS and VS 2003. I've downloaded a windows service project from the remote server and installed it successfully in my system using installutil.exe. I'm able to start and stop the service now. But I couldn't debug the service. I've tried Debug -> Processes -> Attach. Even then I'm getting the following error.
"Windows Service Start Failure
Cannot start service from the command line or a debugger. A windows service must be first installed (using installutil.exe) and then started with the Server explorer, Windows Services Administrative tool or the NET START command."
I wanna insert a breakpoint in the onStart() method to understand the program logic. I'm a beginner in .NET.
Can you please help me in debugging the service?
Thanks in advance..
Vanathi
推荐答案
如果你只是想要了解程序逻辑,你可以简单地将它作为普通应用程序而不是服务运行。
以下是一个很好的例子:
http://www.codeproject.com/KB/dotnet/DebugWinServices.aspx [ ^ ]
祝你好运!
If you simply want to understand the program logic you could simply run it as a normal application instead of a service.
Here is a nice example of how it can be done:
http://www.codeproject.com/KB/dotnet/DebugWinServices.aspx[^]
Good luck!
您可能还想查看此提示/技巧:
Windows服务问题或测试代码问卷 [ ^ ]
我不知道这是不是你的问题,但确保在所有正确的地方使用合适的名称都没有坏处。
You might also want to check this tip/trick out:
Windows Service Gotcha or Test Your Code Regardles[^]
I don't know if this is what your problem is, but it wouldn't hurt to make sure the appropriate name is used in all the right places.
这篇关于无法调试Windows服务..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!