Share via


How to Install/Uninstall .NET Windows Service [C#]

Introduction

This article demonstrates how to Install/Uninstall .NET Windows Service using C#.NET. This article starts with introduction of Install/Uninstall .NET Windows Service using C#.NET.

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

Step-1

Open command prompt window

Open InstallUtil.exe directory for framework 2.0 path is “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\


Figure 1

Step-2

After that .NET service run command similar to this (specify full path to your service).

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


Figure 2

Step-3

And if you want to uninstall windows service you just add ‘/u’ in between installutil.exe and path

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



Figure 3

Final Step

For service check after install you just open to local services and find your service in


Figure 4

*** ***

*** ***

Summary

In this article, I discussed how we can Install/Uninstall .NET Windows Service using C#.NET.  using InstallUtil.exe