Windows Service 怎么调试

Kstar 2006-01-20 11:32:18
公司有个service程序有些问题,我在。net下运行源码时出现

Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.”
是不是这程序必须通过 services才能运行??如果这样怎么调试呢?
...全文
575 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
hyena041 2006-01-20
  • 打赏
  • 举报
回复
详细啊
就是把进程挂到.net调试环境中来吧
lsqlxq 2006-01-20
  • 打赏
  • 举报
回复
如果开发windowsService服务 不能调试 那真是太难过了,可以用附加进程的方式调试。
但这种方式不好调试Onstart,当启动服务报“没什么可做的”的错误时,不好调试,这时可以把一些信息写到系统日志调试。。
Kstar 2006-01-20
  • 打赏
  • 举报
回复
孟子果然厉害,一下给了那么多,谢了
孟子E章 2006-01-20
  • 打赏
  • 举报
回复
http://www.codeproject.com/dotnet/DebugWinServices.asp
Debugging Windows Services under Visual Studio .NET
孟子E章 2006-01-20
  • 打赏
  • 举报
回复
How to debug Windows services

http://support.microsoft.com/default.aspx?scid=kb;en-us;824344
孟子E章 2006-01-20
  • 打赏
  • 举报
回复
1. Start the service so that it is running.

2 .Go into the your Visual Studio click debug->processes. Make sure the show system processes check box is checked. Find the name of your windows service exe. Highlight it then click attach.

3. In the next dialouge box check Common runtime language only then ok button.

4 . Visual studio will now be in debug mode.

5. The last and final step is to set a break point if you havent already done so in your project. The service will then break and you can step through.
孟子E章 2006-01-20
  • 打赏
  • 举报
回复
Debugging Windows Services

http://www.ondotnet.com/pub/a/dotnet/2003/09/02/debuggingsvcs.html

111,119

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧