zoukankan      html  css  js  c++  java
  • 调试windows services

    When I need to debug a windows service I usually make a call to Thread.Sleep and then attach the debugger manually.

       1:  protected override void OnStart(string[] args)
       2:  {
       3:   
       4:      Thread.Sleep(10000);
       5:   

    But now I have realized that there is an easier solution to this problem and it is to launch the debugger by yourself!

       1:          protected override void OnStart(string[] args)
       2:          {
       3:   
       4:              #if DEBUG
       5:              if (Properties.Settings.Default.Debug)
       6:              {
       7:                  System.Diagnostics.Debugger.Launch();
       8:              }
       9:              #endif
  • 相关阅读:
    Google
    LeetCode 664. 奇怪的打印机
    LeetCode 79. 单词搜索
    LeetCode 224. 基本计算器
    Windows 端口映射
    LeetCode 354. 俄罗斯套娃信封问题
    LeetCode 300. 最长递增子序列
    LeetCode 338. 比特位计数
    LeetCode 395. 至少有K个重复的最长子串
    LeetCode 424. 替换后的最长重复字符
  • 原文地址:https://www.cnblogs.com/jintan/p/1232211.html
Copyright © 2011-2022 走看看