Easier way to debug a Windows service

后端 未结 28 1938
春和景丽
春和景丽 2020-11-22 15:36

Is there an easier way to step through the code than to start the service through the Windows Service Control Manager and then attaching the debugger to the thread? It\'s ki

28条回答
  •  不要未来只要你来
    2020-11-22 16:12

    What I usually do is encapsulate the logic of the service in a separate class and start that from a 'runner' class. This runner class can be the actual service or just a console application. So your solution has (atleast) 3 projects:

    /ConsoleRunner
       /....
    /ServiceRunner
       /....
    /ApplicationLogic
       /....
    

提交回复
热议问题