1. Install service: installutil yourservice.exe
2. uninstall service installutil/u yourservice.exe
If the service is running, the command will stop serive and uninstall it.
3. Start Service Net start "your service"
"Your service" is the value of system. serviceprocess. serviceinstaller. servicename in the projectinstaller class. It is the service name that you can see in the Service Manager.
4. debug the service and start Visual Studio 2008. Open your yourservice project. Select "debug-> attach to process ...".
5. Attach yourserice.exe in the attach to process window. If you cannot see your yourserice.exe, select "show processes from all users". Then you can see the service running with the system account. If you have set a breakpoint, when serice runs to the breakpoint you set,ProgramIt will stop and wait for your debugging.
6. yourservice.exe must be compiled in debug mode.