I'm using .Net Remoting. I have 2 servers - one listens for a soap object, the other listens for a binary object:
server1 (soap):
HttpChannel = new HttpChannel(1234);
ChannelServices.RegisterChannel(chnl);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(Server1Object),
"server1.soap",
WellKnownObjectMode.SingleCall);
server2 (binary):
IDictionary props = new Hashtable();
props["name"] = "MyHttpChannel";
props["port"] = 2345;
BinaryServerFormatterSinkProvider srv = new BinaryServerFormatterSinkProvider();
HttpChannel channel = new HttpChannel(props,null,srv);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(Server2Object),
"server2.rem",
WellKnownObjectMode.SingleCall);
On my client I want to call each server. I first register the channels:
HttpChannel soapChannel = new HttpChannel();
ChannelServices.RegisterChannel(soapChannel, false);
BinaryClientFormatterSinkProvider clnt = new BinaryClientFormatterSinkProvider();
HttpChannel binaryChannel = new HttpChannel(null, clnt, null);
ChannelServices.RegisterChannel(binaryChannel);
I get the object from server1:
var server1 = Activator.GetObject(typeof(IServer1Object), "http://server1:1234/Server1.soap");
I get the object from server2:
var server2 = Activator.GetObject(typeof(IServer2Object), "http://server2:2345/Server2.rem");
How should I tell it to use the soapChannel (ie soap formatting) for the first object, and binaryChannel (ie binary formatting) for the second?