找回密码
 立即注册
相关推荐换一批
  1. YS/T 273.5-2006 冰晶石化学分析方法和物理性能测定方法 第5部分: 火焰原子吸收光谱
  2. GB/T 20259-2006 大洋多金属结核化学分析方法
  3. GB/T 18115.9-2006 稀土金属及其氧化物中稀土杂质化学分析方法 镝中镧、铈、镨、钕?
  4. GB/T 18115.4-2006 稀土金属及其氧化物中稀土杂质化学分析方法 钕中镧、铈、镨、钐?
  5. GB/T 18115.11-2006 稀土金属及其氧化物中稀土杂质化学分析方法 铒中镧、铈、镨、钕
  6. GB/T 18115.6-2006 稀土金属及其氧化物中稀土杂质化学分析方法 铕中镧、铈、镨、钕?
  7. GB/T 18115.10-2006 稀土金属及其氧化物中稀土杂质化学分析方法 钬中镧、铈、镨、钕
  8. GB/T 775.3-2006 绝缘子试验方法 第3部分:机械试验方法
  9. GA/T 583-2005 红外照相、录像方法规则
  10. SN/T 0973-2000 进出口肉及肉制品中肠出血性大肠杆菌O157:H7检验方法
  11. GA/T 584-2005 紫外照相方法规则
  12. GA/T 594-2006 保安服务操作规程与质量控制
  13. GA/T 593-2006 光致发光照相、录像方法规则
  14. GA/T 597-2006 中毒检材中静松灵的定性定量分析方法
  15. GB/T 19894-2005 数码照相机 光电转换函数(OECFs)的测量方法
  16. HB/Z 106-1986 飞机结构密封工艺
  17. SN/T 0223-1993 出口冻生小虾仁检验方法
  18. SN 0047-1992 出口黄酒检验规程
  19. SL 83-1994 碱度(总碱度、重碳酸盐和碳酸盐)的测定(酸滴定法)
  20. SJ 1281-1977 金属镀层和化学处理层厚度的检验方法
  21. SJ 1280-1977 金属镀层孔隙率的检验方法
调试方法服务service | 软件设计/软件工程 2022-05-02 441 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开发——实现菜单左右