Translate

How to create a Windows Service to run scripts using C# | Part 3

How to create a Windows Service to run scripts using C# | Part 3
Today we are going to talk about how to manually install our service.

Installing services using installutil.exe

installutil.exe is an application bundle under .Net framework which is used to install Windows Services, installutil.exe can be accessed via a Visual Studio command prompt.

To do this: Open the Visual Studio command prompt, type installutil and hit enter. Once you do so, you should see an output as below – if so, installutil.exe is successfully functioning.

installutil for windows service

If not, please check whether installutil.exe is available by navigating through C:\Windows\Microsoft.NET\Framework\vX.X.XXXXX If not, you’ll need to install the latest version of .Net

Next, set up installutil.exe on Windows PATH to run it as a global command-in-command line.

Now that we’ve confirmed that installutil.exe is working, let's begin installing our application as a Windows Service.

CD into where your PHPWinService.exe is and type installutil PHPWinService.exe

If you get an output similar to the image below, you are on track:

Using installutil for windows service

In order to verify above, go to Service Manager and check for PHPWinService, if available give about 30 - 60 mins and check the database/table for records(you might need to start the service or restart your computer for the first time).

Uninstall a service, created using installutil.exe

This is pretty much the same as installing a service using installutil.exe - except with an extra trigger:

Confirm as to whether the service has stopped in the Service Manager before uninstalling. CD into your service installation folder and type installutil/u PHPWinService.exe

You should see an output similar to the image below (to confirm further, please check your Service Manager)

Using installutil for windows service

Related post -
How to create a Windows Service to run scripts using C# | Part 1
How to create a Windows Service to run scripts using C# | Part 2
How to create a setup wrapper with Microsoft Visual Studio

No comments:

Post a Comment

Nerdcore is a free tutorial website about latest technological development, designing and programming. Nerdcore have tuts for all skill levels in web, desktop and mobile application development. Tuts and courses we provided are carefully crafted by expert developers and designers from www.waan.it