c# - Run a Windows Service as a console app -


i want debug windows service pops error message saying

cannot start service command line or debugger. windows service must installed using installutil.exe , started server explorer, windows services administrative tools or net start command.

i don't have idea error.....

enter image description here

before windows service can run, has "installed" first using installutil. eg:

c:\installutil -i c:\path\to\project\debug\service.exe 

then can open list of services start it. eg:

  1. right click 'my computer'
  2. click on 'manage'
  3. open 'services , applications'
  4. click on 'services'
  5. find service in list , right-click on it
  6. click on 'start'

once has started, can go visual studio, click on 'debug', click on 'attach process'.

another technique add line onstart() method in service:

system.diagnostics.debugger.launch(); 

when that, it'll prompt pick instance of visual studio debug service in.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -