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
  • 相关阅读:
    文件操作(IO 技术)
    异常
    面向对象进阶
    面向对象
    函数用法和底层分析
    控制语句
    集合
    字典
    元组 tuple
    Python3 列表
  • 原文地址:https://www.cnblogs.com/jintan/p/1232211.html
Copyright © 2011-2022 走看看