A few days back while working on a windows service, I used
below line for debugging purpose:
System.Diagnostics.Debugger.Launch();
This line worked fine and I got my service debugged. Then I tried
to deploy service on our server machine. I used below two commands for installing my service
InstallUtil.exe
-i
NET
START
InstallUtil worked fine but when I fired NET START, it
failed saying, service couldn’t be started. I didn’t have any proper
explanation of this but by hit and trial I found that line I used for diagnosing
(System.Diagnostics.Debugger.Launch())
was creating problem somehow, I just commented that line and everything just
worked fine.
If you have some windows service that is having some trouble
in starting, then try to check this case.
Thanks.