To extend the answer to @RonCohen -
On the server, as a rule, a full channel is created in an interesting way (especially if you want to fix the TypeLevelFilter ala problem https://stackoverflow.com/a/167295/):
BinaryServerFormatterSinkProvider serverProvider; BinaryClientFormatterSinkProvider clientProvider; Hashtable properties = new Hashtable(); serverProvider = new BinaryServerFormatterSinkProvider(); serverProvider.TypeFilterLevel = TypeFilterLevel.Full; clientProvider = new BinaryClientFormatterSinkProvider(); properties.Add( "port", 8080 ); this.chan = new TcpChannel( properties, clientProvider, serverProvider ); ChannelServices.RegisterChannel( this.chan, true );
Let's say you use a sponsor on the client side. If you do not, and the client does not call the remote object for a while, the server will drop the object:
Object '/70c96e17_02a8_4e1a_a040_7b671b4a66b4/3fssua+asfozgeqqkrjql+4k_1.rem' has been disconnected or does not exist at the server.
So, you use a sponsor, which then sometimes causes a restart of the remote object. But! Now the server has a remote object - the sponsor gets remote access to the server side when the sponsor calls ILease.Register . But if the server does not have a remote channel for the client, this fails.
Thus, just as the server must provide the client with a remote channel for accessing the remote objects, the client must provide the remote channel with the server so that the server can access the remote objects as sponsors. In the end, both my client and server side have the same channel build code (above), except that I use different port numbers on each side.
antiduh
source share