How do I debug Windows services in Visual Studio?

后端 未结 17 773
梦毁少年i
梦毁少年i 2020-11-28 03:56

Is it possible to debug the Windows services in Visual Studio?

I used code like

System.Diagnostics.Debugger.Break();

but it is givi

17条回答
  •  情话喂你
    2020-11-28 04:19

    Just add a contructor to your service class (if you don't have it already). Below, you can check and example for visual basic .net.

    Public Sub New()
       OnStart(Nothing) 
    End Sub
    

    After, that, right-click on project and select "Debug -> Start a new instance".

提交回复
热议问题