找回密码
 立即注册
相关推荐换一批
  1. GB/T 16886.10-2000 医疗器械生物学评价 第10部分:刺激与致敏试验
  2. GB/T 16860-1997 感官分析方法 质地剖面检验
  3. GB/T 16850.7-2001 光纤放大器试验方法基本规范 第7部分:外带插入损耗的试验方法
  4. GB/T 16850.5-2001 光纤放大器试验方法基本规范 第5部分:反射参数的实验方法
  5. GB/T 16850.3-1999 光纤放大器试验方法基本规范 第3部分:噪声参数的试验方法
  6. GB/T 16850.2-1999 光纤放大器试验方法基本规范 第2部分:功率参数的试验方法
  7. GB/T 16850.1-1997 光纤放大器试验方法基本规范 第1部分:增益参数的试验方法
  8. GB/T 16822-1997 介电晶体介电性能的试验方法
  9. GB/T 16701.1-1996 热电偶材料试验方法 第1部分:贵金属热电偶丝热电动势测量方法
  10. GB/T 16688-1996 信息处理系统 开放系统互连 联系控制服务元素服务定义
  11. GB/T 16659-1996 煤中汞的测定方法
  12. GB/T 16658-1996 煤中铬、镉、铅的测定方法
  13. GB/T 16613-1996 试验用聚氯乙烯(PVC)糊的制备 分散器法
  14. GB/T 16600-1996 钨的发射光谱分析方法
  15. GB/T 16599-1996 钼的发射光谱分析方法
  16. JB/T 4022.1-1999 合金铸造性能测定方法 自由线收缩测定方法
  17. JB/T 3914-1999 超硬磨料 取样方法
  18. JB/T 3732.1-1998 剃齿机 性能试验方法
  19. JB/T 3686.2-1999 煤用浮选机 试验方法
  20. JB/T 2930-1991 低压电器 产品型号编制方法
  21. GB/T 4341-2001 金属肖氏硬度试验方法
  22. GB/T 4336-2002 碳素钢和中低合金钢火花源原子发射光谱分析方法(常规法)
  23. GB/T 4331-2003 农用挂车试验方法
  24. GB/T 5861-2003 液压快换接头试验方法
调试方法服务service | 软件设计/软件工程 2022-05-02 542 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
在开发Windows服务的时候,调试起来不是很方便,因为这样的程序是没有屏幕的。

一般调试是在服务启动后通过附加进程进行调试,但是服务启动过程中执行的代码不能通过这种方式进行调试。

另外,在服务的启动方法中加入thread.sleep()方法,让它休眠几秒,这样就有时间通过??attach process方法调试服务启动过程中执行的代码。

不过很高兴最近在博客园看到一个问题,里面提到了一个调试服务的方法,非常简单好用,给了我很多帮助。在此,谢谢大哥。



调试方法:

   在服务的 start() 方法中,添加: System.Diagnostics.Debugger.Launch();这段代码。这样在启动服务时会默认打开vs的调试窗口进行调试,

只需要提前设置断点,是不是很方便?

(When developing windows services, debugging is not very convenient, because such programs have no screen.
Generally, debugging is performed through additional processes after service startup, but the code executed during service startup cannot be debugged in this way.
In addition, add thread. In the service startup method Sleep () method, let it sleep for a few seconds, so that it has time to pass?? The attach process method debugs the code executed during service startup.
I'm very glad to see a lot of simple debugging methods mentioned in the blog recently, but I'm very glad to see a good one. Here, thank you, brother.
Commissioning method:
In the start () method of the service, add: system Diagnostics. Debugger. Launch(); This code. In this way, the debugging window of vs will be opened for debugging by default when starting the service,
Is it convenient to set breakpoints in advance?
)





上一篇:回调机制
下一篇:ANDROID UI开发——实现菜单左右