Base class for Windows service

My new project has a design that has several window services to perform various tasks. I was tasked with creating a base class from which all Windows services inherit. This base class will perform common functions such as instantiating other Windows services by iterating through a config file (could be as Activator.CreateInstance), logging events on onStart, onStop, etc. And it may contain some more functions.

Before I start developing the material, I wonder if there is any template already in place or if someone has a good understanding of how to implement such functionality.

Any help was appreciated.


I forgot to mention I am using .Net 2.0 (C #), no option for wcf

+2


source to share


2 answers


Check "Simple Windows Service to Host WCF or WF Services" , I really like that.



0


source


Look in your main method, when you create a windows service and you can see that the subroutine does not call onstart and onstop, you can create each service with createinstance and pass it as a paramater to ServiceBase.Run , in your case, each service will not show as a separate service, ServiceController is a great class for starting and stopping services, use it if you need



0


source







All Articles