Looking for some guidance on feasibility and implementation.. I would like to accomplish the following;
Create a custom ServiceHostFactory that can be used within IIS and Console/Service apps that scans a configuration for any registered services and loads them (I can do this via Unity) but also understands via the same config that a service may be hosted in multiple locations and does some load-balancing — say round robin for simplicity — on every call. Id also like this factory to (somehow) provide configuration data to the service, like a custom appsettings provider and allow those settings to change, additional service host locations for each service to be added/removed from load balancing, and other such management events. Ideally at runtime..
I believe this is possible, but not sure how? I’ve figured out the following;
- Load service implementation dlls via Unity
- Also host a ‘config’ service and create a custom settingsprovider that talks to this
- how do I ‘invalidate’ a setting when it changes?
Still not sure how to implement round-robin and the eventing..
Any suggestions? Has this been done before? Are there samples available? MS StockTrader 5 seems to do something similar with azure, but i can’t make heads or tails of the code and how it’s all wired up..
UPDATE: In reading further, I think what Im after is a WCF routing service that can understand commands.. i.e. a routing service that i can send commands like ‘add service’ at runtime.. Still not really clear on whether this is possible?
Turns out ServiceRoutes in global.asax are close enough to fake this functionality. Added a serviceroute to a routing service and that’s all it took.