How to Install a Windows Service Using InstallUtil and command prompt from
Naeem Akram on
Vimeo.
A demo day be really frustrating or it can be the happiest day of an IT professional's life.
Now I'm going to demonstrate the stuff which we've created so far in this course
You may join my course with special discount using the link given below.
https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/?couponCode=HALF
The windows service solution is already open
I'll go and click build and build solution
Now I'm going to expand solution explorer
And click the button , "Show all Files"
Next I'm going to expand the "bin" folder
then I'll right click the "debug" folder and select "open folder
location"
Take a brief look at the contents of this folder
The file Udemy Windows Service dot exe is going to run as our service.
For this purpose, we're going to use
installutil.exe
It is shipped along with Microsoft .Net framework.
For this purpose I'm going to launch the developer command prompt
I'll click the Windows Button and type "Developer command prompt"
The developer command prompt for vs is showing on top
I'll right click this shortcut and select menu option "Run as
administrator"
Now I'm going to type the command installutil.exe space -i space
And then the path of the file which we want to install as a service.
I'll go back to the debug folder and shift right click the Udemy
Windows Service .exe file
I'll select the context menu option "Copy as path"
Now I'll go back to the command prompt windows
I'll right click it and select context menu option edit
And then select Paste
The full command is installtuil.exe pace minus i space path of
our windows service exe file
I will hit enter key on command prmopt
The system shows that the commit phase completed successfuly
Let us see if the service is showing up service control managter
or not
I'll open the SCM by pressing Windows R and typing services.msc
Inside the name column, I'll look for Udemy Demo Service
We can click inside the name column and press Udemy
You can see our very own Windows Service named "Udemy Windows Service"
along with the descritpion
"My hello world servoce" right here
And it has got logon as "Local System"
You'll see that status of the service will change to "Running"
The actions button on top right will also change from start to stop
and restart
I'm now going to click the stop link and that should stop the service
without any fuss
You see a progress bar popup
And the service status is changed to stopped.
That is it for this video
In the next one we'll take a look at the event log