Labels

Tuesday, July 7, 2015

Installing / Uninstalling a Windows Service

Steps to install a Windows Service:

1. Open the Windows Service Solution in Visual Studio.
2. Make sure the target platform was set properly according to the machine you are trying to install the service.










3. Build the Solution in Debug / Release mode.
4. Copy the files generated in the Debug / Release folder (based on the mode selected in the above step) to some new folder.
5. Open the command prompt as an administrator.
6. Type the below command:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>InstallUtil.exe <Full File path of the Executable generated for your service (new folder path created in step 4)>

(Ex: C:\Pardha\NewService\SchedulerService\SampleService.exe)

7. Press Enter.
8. The below message appears at the end if the installation is successfully completed.

  • "The Commit phase completed successfully."
  • "The transacted install has completed."

9. Check your service in the services list. (services.msc)
10. Set the user context under which the service has to run & then Start it Manually.

To Uninstall:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>InstallUtil.exe /u <Full File path of the Executable generated for your service (new folder path created in step 4)>