我目前正在使用 C# 构建 Windows 服务,但我不知道如何调试它。
我正在构建它,然后使用 installutil
注册:
> installutil MusicRepo_FileMonitor.exe
The Commit phase completed successfully.
The transacted install has completed.
正如您在上面看到的,它应该已成功注册,但我在 services.smc
中找不到它。我还尝试使用 net start [ServiceName]
启动服务,但它告诉我服务名称无效。
所以我猜它没有找到它。
郑重声明,我使用的是 Vista,并且正在使用 .Net 3.5 开发 ws
[更新]
最佳答案
尝试任务管理器并查看是否看到 MusicRepo_FileMonitor.exe。如果没有,那么该服务肯定没有运行。
或者,在 Visual Studio 中,“调试”>“附加到进程”,检查所有用户的显示进程,并查看其是否存在。
关于C#:运行和调试 Windows 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/711241/