【问题标题】:System.Diagnostics.Debugger.Launch(); on Visual Studio C# 2010 Express editionSystem.Diagnostics.Debugger.Launch();在 Visual Studio C# 2010 速成版上
【发布时间】: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


    【解决方案1】:

    我不知道你可以这样做。我通常这样做的方式是向服务添加一些命令行选项,所以如果它以[servicename].exe -c 启动,它会作为普通可执行文件启动,然后我只需将 -c 设置为 Visual Studio 中的启动参数。

    所以在我的主要内容中,我有类似的东西:

    if(IsConsole)
       ExecuteTheProcess();
    else
    {
       ServiceBase[] servicesToRun = { new MyService(); }
       ServiceBase.Run(servicesToRun);
    }
    

    【讨论】:

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