You cannot start the Windows service, as another console or WinForms application says. It should be launched by Windows itself.
If you donβt have an infrastructure ready to use, as @Damien_The_Unbeliever offers (this is what I recommend), you can install this service from a debug location. Therefore, you use installutil once and point it to the executable located in /bin/debug . Then you start the service from services.msc and use the menu Visual Studio > Debug > Attach to Process and join the Windows service.
You can also use Thread.Sleep(10000) as the first line in an OnStart or Debugger.Break() call to help you connect before the service does any work. Remember to remove them before release.
oleksii
source share