Issues with Cloning MarshalByRefObject

Cloning MarshalByRefObjects can lead to some unexpected behaviour. When a MBR object is marshalled, it gets an unique identity which contains a unique URI to identify this object in the appdomain. When an external call is made to this object it is identified by this URI. An identity once created doesnt change each time the…

2

using $hostName in remoting server channel config

If you set machineName=”foo.com” in the server side remoting config (to avoid using ip addresses) and probably need to deploy the same config on multiple servers use machineName=”$hostName” and remoting will substitute this with the current host dns qualified name. This way you dont have to hardcode any machinenames in config. Note: this is only available…

0

Different ways to activate CLR types remotely

A CLR type instance can be activated remotely in the following ways: 1. Through Config: This is probably the most common way. Use the client tag under system.runtime.remoting to register a type to go remote:<configuration>  <system.runtime.remoting>    <application>      <client>        <wellknown type=”Hello.HelloService, Hello” url=”http://localhost:8000/HelloService.soap” />        <activated type=”Hello.HelloActivatedService, Hello” url=”http://localhost:8000” />      </client>    </application>  </system.runtime.remoting></configuration> 2. RegisterWellKnownClientType or RegisterActivatedClientType:…

2

static method/field access in remoting

This is probably not a very wellknown fact, but static methods and fields accessed via a remoting proxy, are actually executed locally on the client side. So even though a type is configured to go remote static accesses/invokations dont go remote. If you need to access static data on the server side, you need to…

1

can remoting Singletons be GCed?

Infact they could. The contract for a remoting singleton wellknown object is that “a” object would always be available on the remoting wellknown endpoint. It doesnt mean the same single instance is always available. Singletons also follow the same leasing behaviour like client-activated objects. They would be cleaned up if the lease on a particular…

0

Channel priority in remoting

Each remoting channel has a priority associated with it. If there are multiple channels registered in the same appdomain and a MarshalByRefObject is marshalled out, all available channel data will flow with the ObjRef. The order is which this channel data is placed depends on the priority of the channel. You could change the priority…

0

versioning serialized delegates

Got an interesting question about how to deserialize delegates serialized with an older version of an assembly. While deserializing, if the older version isnt available the engine might throw a TypeLoadException. The Serialization binder doesnt help in this case since Delegate holders implement IObjectReference and are serialized as simple type and method names (the holder itself…

1

Does a remoting client need to register a channel?

A remoting client need not register a channel (if its http or tcp) when making a remote call. The remoting infrastructure will load an appropriate channel after looking at the scheme of the URL (tcp:// or http://). Though being explicit in code is goodness for the channel case it can lead to unwanted results in…

0

Implementation isolation in remoting

As is common knowledge remoting needs server assemblies on the client for remote communication. In many cases sharing server implementation with the clients is undesirable. Interfaces can be used to acheive this isolation. An assembly which contains only interface definitions can be shared between the client and the server. A class factory pattern can be used if client…

1

Failures in AppDomain.Unload

There are a couple of reasons why appdomain unloads can fail. One common failure is when all threads inside the appdomain cannot be unwound. This mostly happens when there are threads running unmanaged code. In a remoting case its possible a thread that could be performing active IO at the winsock layer when the unloading is…

0