Deleted and Missing Channels

I came across an exception:

"This remote proxy does not have a channel sink, which means that there are no registered server channels on the server that are listening, or this application does not have a suitable client channel for talking to the server."

The reason is best explained in this blog post I found:

The second case is more obscure. This happens when the client makes a call to the server, the server returns a link to the object, and then the client makes a call to the specified object on the server. If the link object is in the secondary AppDomain on server, the above exception may be thrown. If a problem occurs because only the channel registration is applied to the AppDomain in which the RegisterChannel is called and there is no channel registered to the secondary AppDomain. The link object returned to the client points to the object in the secondary AppDomain, not its proxy in the main AppDomain, and therefore there is no channel between the client and the secondary AppDomain through which the call can go. Solution: register the channel in the secondary AppDomain to which exists on the specified object.

This fits my scenario as I have a service that loads plugins into separate application areas. Object instances (interface implementations defined in the assembly referenced by all assemblies) are created in the secondary application domains and refer to the service (cross-domain, so the service has proxy links). The service then returns these proxy links for the application. There are registered channels between the application and the service, but nothing happens between the plugin and the application.

I thought a proxy would be enough to cross domain boundaries. Do I need to create channels between plugins and application? This does not seem right, so I have to skip something.

+5
source share
3 answers

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.

+3
source

To use remote relocation between application domains on objects obtained from MarshalByRefObject, you need to create channels at both ends. Therefore, you must create channels in each application. There are effective channels for local use on a single computer, for example. IPC pipe (uses named pipes).

If the message is “one-way”, in the sense that only one of the parties calls methods in the proxy, you register here the client channel and the server channel on the side that creates the objects.

If you need to go in both directions, for example. to transfer the registration object to the “server” in order to receive continuous feedback from the log, you must register the server channel from both ends, as the client unexpectedly also serves the objects:

 class MyLogger : MarshalByRefObject { public Log(string text) { ... } } MyLogger logger = new MyLogger(); proxyObj.LongRunningCommand(logger); 
+2
source

For those who are looking for "Proxy server error without proxy server ...", I got this error when I called the VB.NET COM library terminated in VBScript. All this was on the same Windows 7 machine, so there should have been no problems with the client server. In the end, I found out that the error was caused by the fact that I missed a load of arraists filled with strings, and not filled with singles, which was what the function that I called was expecting. I don't understand why I got this error, but hopefully this can help someone get this error.

0
source

All Articles