You cannot just hit Run and debug your Windows Service. That would be really cool, but it is not that hard to get it running.
Build and Install service on your pc:
Choose Build in the Menubar above and choose Build NewService.
This will build your executable in the bin\release folder of your project. If you try to run the program by itself, it will not run and give you an error. Instead you have to load the service into your computer by using InstallUtil.exe.
You can run InstallUtil.exe from the VisualStudio Command Prompt.
InstallUtil “PATH_TO_YOUR_EXE.exe” /U
When you run in the command window, you will see alot of text, and at the bottom it should read:
The Commit phase completed successfully.
The transacted install has completed.
Now we have to start the service in Service Manager. – Right click on My Computer on the Desktop, and choose Manage.
Choose Services and Applications, Services, and New Service:
Right click and Choose Start.
Then Go to EventViewer, Application and you should see a log for service starting, and after 10 seconds you should see your ‘Service Running” log entry
Now you have a running Service. Don’t forget to stop it. You dont want to fill your Event log up! We set the service to Automatic in Part 2, so you may want to uninstall using InstallUtil.exe to remove from your system.
Next we will build a Setup package so you can install easily on computers that are not running Visual Studio.
Services Part 4:> Build Setup Package for your Windows Service
Programmers – Use your talents to make some money online. Click Here to Read More