1.Prefer administrative configuration to programmatic configuration.
2.Always implement IDisposable on single-call objects.
3.Always prefer a TCP channel and a binary format when using remoting, unless a firewall is present.
4.Always provide a null lease for a singleton object:
public class MySingleton : MarshalByRefObject
{
public override object InitializeLifetimeService( )
{
return null;
}
}
5.Always provide a sponsor for a client-activated object. The sponsor should return the initial lease time.
6.Always unregister the sponsor on client application shutdown.
7.Always put remote objects in class libraries.
8.Avoid using SoapSuds.exe.
9.Avoid hosting in IIS.
10.Avoid using uni-directional channels.
11.Always load a remoting configuration file in Main( ), even if the file is empty and the application does not use remoting:
static void Main( )
{
RemotingConfigurationEx.Configure( );
/* Rest of Main( ) */
}
12.Avoid using Activator.GetObject( ) and Activator.CreateInstance( ) for remote object activation. Use new instead.
13.Always register port 0 on the client side, to allow callbacks.
14.Always elevate type filtering to Full on both client and host, to allow callbacks.