protected override void OnStart(string[] args)
{
#if (DEBUG)
Debugger.Launch();
#endif
}
Tips to Install/Unistall/Run/Stop Windows Service using Visual Studio
From the menu, select Tool then External Tools, and add this item.
Title: Install Service
Command: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
Arguments:
Initial directory: $(ProjectDir)/bin/debug
Title: Uninstall Service
Command: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
Arguments:
Initial directory: $(ProjectDir)/bin/debug
Title: Run Service
Command: NET.exe
Arguments: START "
Initial directory:
Title: Stop Service
Command: NET.exe
Arguments: STOP "
Initial directory: