Windows Services are long-running executable applications that runs at the background, which has the ability to start automatically when the computer boots and also can be manually paused, stopped or even restarted.
Following are the steps to create a service:-
Create a project of type “Windows Service”.
Figure 2.5:- Windows service
If you see, the class created it is automatically inheriting from “System.Service Process.ServiceBase”
You can override the following events provided by service and write your custom code. All the three main events can be used that is Start, stop and continue.
Now to install the service you need to do run the install util exe.
Huge collection of c# and .NET interview question videos: – c# and .NET interview question videos.
This .NET interview question is taken from the book .NET interview questions and answers book by Shivprasad koirala.