Configure Multiple locations for remote objects.

I faced this problem once while working on a distributed application using .Net remoting, basically i wanted to implement some kind of load - balancing, so i figured that i could have the server objects running on different machines and the urls for all server machines in the config file. The problem is if you have multiple urls for the same type in the config file and do RemotingConfiguration.Configure() then it throws an excpetion saying that you are trying to redirect and already registered type.

So i wrote this small class that reads the configuration file and parses it and allows you to get the list of WellKnown as well as Activated client types, you can then just directly activate the object without registering it.

I was initially planning on posting the code directly to the blog but it seems to be a bit too long to post directly to a blog, maybe Scott can provide some space where i can upload some of my files :) :) otherwise i will have to look for some site that allows me to post code snippets. Google here i come.

 

No Comments