Showing posts with label Windows Service. Show all posts
Showing posts with label Windows Service. Show all posts

Dec 2, 2009

Installing Windows Service

Installing a windows ervice is as simple as running this code on a windows commmand prompt:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /u " myservice1.exe"

Note: The above line of code installs a service using .net framework 2.0 (choose yours) whose assembly is myservice1.exe.
If you are unsure what your assembly name is, just look into the bin/debug folder of your
windows service project and you will find the exe there.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe " myservice1.exe"

Note: The above line of code uninstalls a service using .net framework 2.0 (choose yours) whose assembly is myservice1.exe.

If you are unsure what your assembly name is, just look into the bin/debug folder of your windows service project and you will find the exe there.

Also the "myservice1.exe" must be the full path to your service exe unless you are running command from the same folder.

Debugging Windows Service

If you have just started to learn how to create windows service, first question would be how to debug service. This article on codeproject http://www.codeproject.com/KB/tips/EasyDebugWindowsServices.aspx by Eric De Carufel shows exactly how you can debug windows service and have control over it.  I especially liked the winform provided there using which you can start, pause continue or stop your windows service.
It is very easy, just follow the steps or download the source code if required.