开发者

Base class for windows service

My new project has a design in which there are number windows services for performing different tasks. I have been given a task to create base class from which all of the windows service will inherit. This base class will perform common functions like creating instances of other windows services by iterating through the config file (may be like Activator.CreateInstance), do event logging on onStart, onStop etc. and may contain some more functionality.

Before I start developing stuff, wondering if there is any pattern already in place or someone has good understanding of how to implement this kind of functionality.

Any help appreciated.


I开发者_高级运维 forgot to mention I am using .Net 2.0 (C#), no option for wcf


Check "A simple windows service to host WCF or WF services", I really like it.


Look in your main method , when you create windows service and you will see that the routine is not call onstart and onstop, you can create each service by createinstance and give it as a paramater to ServiceBase.Run, in your case every service will not appear as a separate service, ServiceController is a great class to start and stop services too, use it if you need

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜