Partager via


More about remoting proxies

As is common knowledge there are two types of remoting objects, server-activated objects (aka wellknown) and client activated objects. The client side proxies for these objects have different behaviour as well. Some issues to be aware of are:

1. RemotingServices.Connect generates a wko proxy, Activator.CreateInstance (or new) generates a cao proxy

2. No remote invokation is made while instantiating wko, cao invokations incur a remote call to "construct" the cao on the server side

3. wko proxies don't carry complete server type hierarchy, cao proxies do

4. wko proxies can be cast of any interface (since v1.1), cao proxies can be cast only to interfaces implemented by the server (as would be expected of a regular clr object)

5. wko proxies are cached per url, cao are not. Thus if you call RemotingServices.Connect to the same url and bind it to the same type, remoting would return the same proxy instance created previously.

Point 4 above is a possible pitfall, since one might expect a cast to succeed only if the type really implements or inherits from the type being cast to. But for wko proxies being cast to interfaces this doesnot hold. The invokation will fail when the call reaches the server but the cast to any interface will pass.