Install / Uninstall .NET Windows Service [C#]
This example shows how to install and uninstall a .NET windows service.
Install service using InstallUtil.exe
To install or uninstall windows service (which was created using .NET Framework) use utility InstallUtil.exe. This tool can be found in the following path (use appropriate framework version number).
To install .NET service run command similar to this (specify full path to your service).
To uninstall .NET service use the same command with
InstallUtil.exe /u "c:\myservice.exe"
Install service programmatically
To install service programmatically using C# see the following class ServiceInstaller in c-sharpcorner.com article.
- [C#] Create Windows Service in Visual StudioÂ â€“ create new service in VSÂ 2005
- [C#] Start, Stop and Restart Windows ServiceÂ â€“ restart a service programmatically
- [C#] Get List of Windows ServicesÂ â€“ how to get list of installed services
- InstallUtil.exeÂ â€“ MSDNÂ â€“ tool to install / uninstall .NET services