Debug Windows Service

后端 未结 11 1417
既然无缘
既然无缘 2020-11-29 17:09

Scenario

I\'ve got a windows service written in C#. I\'ve read all the google threads on how to debug it, but I still can\'t get it to work. I\'ve run \"PathTo.Net

11条回答
  •  孤独总比滥情好
    2020-11-29 18:08

    you can debug it by attaching the debugger to the process. You can do this by either adding a line to the startup of your program:

    Debugger.Launch ();
    

    after adding the using statement:

    using System.Diagnostics; 
    

    you will either need to put that in a conditional block or remove it when you are done debugging

    or by running the service and then attaching to the process manually from the IDE: Debug->Attach to process..

提交回复
热议问题