.NET Services Basics

Installing and Uninstalling a Service

To install or uninstall a Service that was created using the .NET Framework, use the InstallUtil.exe utility.

This utility can be directly invoked from the “Developer Command Prompt for VS2012” which is located at:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat

Or else you can browse directly to the InstallUtil executable which is located in:

C:\Windows\Microsoft.NET\Framework

2015-05-12_18h17_38

To install .NET service run command similar to this (specify full path to your service).

InstallUtil.exe "c:\myservice.exe"

To uninstall .NET service use the same command with parameter /u.

InstallUtil.exe /u "c:\myservice.exe"

Starting and Stopping a Service

This can be accomplished using the

net stop 
net start 
net pause 
net continue

A full list of the exact services is found in the registry (run regedit.exe) under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services key.

Alternatively, you can perform the stop and start using the name that is showed in the Services Control Panel applet by putting the name in quotes, i.e.

net stop "Service-Name"
net start "Service-Name"
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s