Whem I\'m writing a Windows Service and just hit F5 I get the error message that I have to install it using installutil.exe
and then run it.
In practice this me
You cannot run Windows Service as say another console or WinForms application. It needs to be started by Windows itself.
If you don't have infrastructure ready to use as @Damien_The_Unbeliever suggests (which is what I recommend as well) you can install the service from the debug location. So you use installutil
once and point it to executable located in /bin/debug
. Then you start a service from services.msc
and use Visual Studio > Debug > Attach to Process
menu and attach to the Windows service.
You can also consider using Thread.Sleep(10000)
as the first line in the OnStart
call, or Debugger.Break()
to help you out to be able to attach before the service executes any work. Don't forget to remove those before the release.