How to debug the .NET Windows Service OnStart method?

后端 未结 16 1309
离开以前
离开以前 2020-12-01 00:13

I have code written in .NET that only fails when installed as a Windows service. The failure doesn\'t allow the service to even start. I can\'t figure out how I can step int

16条回答
  •  日久生厌
    2020-12-01 00:38

    You can also try System.Diagnostics.Debugger.Launch() method. It helps in taking the debugger pointer to the specified location and you can then debug you code.

    Before this step please install your service.exe using the command line of Visual Studio command prompt - installutil projectservice.exe

    Then start your service from the Control Panel -> Administrative Tools -> Computer Management ->Service and Application -> Services -> Your Service Name

提交回复
热议问题