找回密码
 立即注册
相关推荐换一批
  1. GB/T 7739.3-2007 金精矿化学分析方法 第3部分:砷量的测定
  2. GB/T 20899.11-2007 金矿石化学分析方法 第11部分:砷量和铋量的测定
  3. SB/T 10420-2007 饭店业星级服务人员资格条件
  4. JG/T 199-2007 建筑用竹材物理力学性能试验方法
  5. GB/T 3250-2007 铝及铝合金铆钉线与铆钉剪切试验方法及铆钉线铆接试验方法
  6. YS/T 252.5-2007 高镍锍化学分析方法 硫量的测定 燃烧-中和滴定法
  7. YS/T 252.1-2007 高镍锍化学分析方法 镍量的测定 丁二酮肟重量法
  8. YS/T 240.7-2007 铋精矿化学分析方法 硫量的测定 燃烧-中和滴定法
  9. YS/T 240.11-2007 铋精矿化学分析方法 银量的测定 火焰原子吸收光谱法
  10. GB/T 20991-2007 个体防护装备 鞋的测试方法
  11. YS/T 445.1-2001 银精矿化学分析方法 金和银量的测定
  12. YS/T 445.9-2001 银精矿化学分析方法 铅、锌量的测定
  13. YS/T 445.8-2001 银精矿化学分析方法 锌量的测定
  14. YS/T 445.7-2001 银精矿化学分析方法 铅量的测定
  15. YS/T 445.6-2001 银精矿化学分析方法 氧化镁量的测定
  16. YS/T 445.4-2001 银精矿化学分析方法 三氧化二铝量的测定
  17. YS/T 96-1996 散装浮选铜精矿、铅精矿中金、银分析取制样方法
  18. SN/T 2135-2008 蜂蜜中转基因成分检测方法 普通PCR方法和实时荧光PCR方法
  19. YS/T 121.9-1992 有色金属加工企业真空电弧炉热平衡测试与计算方法
  20. DL/T 1032-2006 电气设备用六氟化硫(SF6)气体取样方法
  21. JB/T 10231.23-2006 刀具产品检测方法 第23部分:滚丝轮
  22. JB/T 3000-2006 铸造设备型号编制方法
  23. GB/T 6379.4-2006 测量方法与结果的准确度(正确度与精密度) 第4部分:确定标准测量?
调试方法服务service | 软件设计/软件工程 2022-05-02 415 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开发——实现菜单左右