【发布时间】:2010-06-30 11:30:03
【问题描述】:
我有一个 Windows 服务,我使用 System.Diagnostics.Debugger.Launch();调试服务。它适用于 VS 2010 Pro RC,不适用于 express 版本...
有没有办法用 express edition 调试 windows 服务?
提前致谢
【问题讨论】:
标签: c# debugging visual-studio-2010 windows-services
我有一个 Windows 服务,我使用 System.Diagnostics.Debugger.Launch();调试服务。它适用于 VS 2010 Pro RC,不适用于 express 版本...
有没有办法用 express edition 调试 windows 服务?
提前致谢
【问题讨论】:
标签: c# debugging visual-studio-2010 windows-services
我不知道你可以这样做。我通常这样做的方式是向服务添加一些命令行选项,所以如果它以[servicename].exe -c 启动,它会作为普通可执行文件启动,然后我只需将 -c 设置为 Visual Studio 中的启动参数。
所以在我的主要内容中,我有类似的东西:
if(IsConsole)
ExecuteTheProcess();
else
{
ServiceBase[] servicesToRun = { new MyService(); }
ServiceBase.Run(servicesToRun);
}
【讨论】: