How to Install or Uninstall C# .NET Windows Service


This article shows how to install or uninstall a .NET Windows Service using C#. This article starts with an introduction of installing and uninstalling a .NET Windows Service using C#.

To install or uninstall Windows Service (that was created using the .NET Framework) use the utility InstallUtil.exe. This tool can be found in the following path.

Step 1

Open a Command Prompt window.

Open InstallUtil.exe in the directory for Framework 2.0; the path is “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\”.

Figure 1

Step 2

Then .NET service runs as a command similar to this (specify the full path to your service):

“InstallUtil.exe C:\DemoService\DemoWindowsService.exe”

Figure 2

Step 3

And if you want to uninstall a Windows Service then you just add ‘/u’ between installutil.exe and the path as in the following:

“InstallUtil.exe /u C:\DemoService\DemoWindowsService.exe”

Figure 3

Final Step

For doing a service check after installing you just open to the local services and find your service as in the following:

Figure 4


In this article, I explained how to install or uninstall a .NET Windows Service using C# using InstallUtil.exe.


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now