【问题标题】:C#: Running and Debugging a Windows ServiceC#:运行和调试 Windows 服务
【发布时间】:2009-04-03 03:45:58
【问题描述】:

我目前正在使用 C# 构建 Windows 服务,但我不知道如何调试它。


我正在构建它,然后在installutil注册:

> installutil MusicRepo_FileMonitor.exe

The Commit phase completed successfully.

The transacted install has completed.

正如您在上面看到的,它应该注册成功,但我在services.smc 中找不到它。我也尝试使用net start [ServiceName] 启动服务,但它告诉我The service name is invalid. 所以我猜它没有找到它。


为了记录,我在 Vista 上,我正在使用 .Net 3.5 开发 ws


[更新]

Solution

【问题讨论】:

  • 创建服务时,您在服务属性中提供的服务名称信息是什么?
  • 服务名称:MusicRepoFolderWatcher

标签: c# windows-services


【解决方案1】:

尝试任务管理器,看看您是否看到 MusicRepo_FileMonitor.exe。如果没有,那么服务肯定没有运行。

或者,在 Visual Studio 中,调试 > 附加到进程,检查所有用户的显示进程,并查看它是否存在。

【讨论】:

    【解决方案2】:

    经过进一步研究,我意识到我没有附加到服务的安装程序,所以现在通过添加安装程序解决了这个问题。

    Here是我用来添加Service Installer等的教程。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-07
      相关资源
      最近更新 更多