Click to See Complete Forum and Search --> : Programmatic configuring the Remoting infrastructure


V.Lorz
February 11th, 2005, 02:49 AM
Hi:

I need to put my own custom IMessageSink, IClientChannelSink and IServerChannelSink into the remoting messages serialization logic, so I created several classes for this. The reason is for providind the avility for the messages to cross throw Internet in an encyphered format.

If I create a config file for this and use a call to RemotingConfiguration.Configure("my_config_file.config") my sinks are properly linked in the chain. This works fine for perfectly separated server and client applications, but in my case I need to access the exposed objects from the same server application.

I tried to use code to programmatically set things up like the one below:

//---------------------------------
BinaryServerFormatterSinkProvider ServProvider = new BinaryServerFormatterSinkProvider();
ServProvider.TypeFilterLevel = TypeFilterLevel.Full;

BinaryClientFormatterSinkProvider BinaryClientProvider = new BinaryClientFormatterSinkProvider();

MyEncryptionClientSinkProvider MyClientProvider = new MyEncryptionClientSinkProvider();
MyClientProvider.Next = BinaryClientProvider;

IDictionary Properties = new Hashtable();

TcpChannel TcpChan = new TcpChannel( Properties, MyClientProvider, ServProvider );

ChannelServices.RegisterChannel( TcpChan );

IMyRem MyRem = (IMyRem)Activator.GetObject( typeof(IMyRem), "tcp://localhost:8080/MyRem.rem" );

//---------------------------------

No compilation error is rised, no exception is rised at runtime, the SinkProvider and Sink object instances are created (constructors are called), but the request and response processing methods for the sink objects never get called.

Why? What am I missing here?