How to develop a WCF Service to automatically manage other related WCF services hosted as Window Service?
Kindly help me in architecting a solution which is required for my ongoing project. I have developed some WCF Services hosted as windows services which I did and working fine so far. Now I am asked to develop a master WCF type of service which should be intelligent enough to manage all othe开发者_运维知识库r WCF service for possible corruption/errors and can repair them and restart. Thanks in advance.
As we have written a custom host and took us years to make it a real application server, I will share some of the challenges that we had. Creating a custom host that manages WCF services as an NT service is a very challenging task if you want to manage all of the details and treat the NT service as a real service host. The challenges start from managing multiple Appdomains ( one for each Service ), managing the statuses of the services, startup times, deployments from the IDE and the worst of all is activation. Have you considered how to implement that? If you do not have this feature, it means that all of your services will be active and in memory at all times. IIS and Appfabric do that very well and trust me , it is noty easy to implement. The other part that was challenging was a UI to manage this host and offcourse a UI that can manage multiple hosts ( NT services running on different boxes ). Do you need a discovery proxy implementation? And at last how about if you want to manage services running in your custom host , IIS and App fabric the same way? Think about before doing such an implementation because the scope may crypt on you as you do it.
I do something similar here.
- Create a
Dictionary<key, ApplicationDomain>
collection into your main programKey
: something unique for each application domain, like aGuid
or aSystem.Type
.
- That
ApplicationDomain
class exposes a internal property to access yourAppDomain
proxy (that which inherits aMarshallByRef
class) - Load your WCF host into main program, so you'll get access to that collection
- Every time your service get some access, you just need to take that key, access your proxy and do anything you want within your service hoster.
Keypoint: Your service must have access to all your service hosts.
精彩评论