Remoting创建远程对象的一个实例:
private static Lazy<IChannelManager> channelManager=new Lazy<IChannelManager>(() =>
{
if (ChannelManagerUrl == null)
throw new InvalidOperationException("未设置ChannelManagerUrl");
Trace.TraceInformation("ChannelManagerUrl={0}", ChannelManagerUrl);
IChannelManager m = null;
if (ChannelManagerUrl.StartsWith("tcp://") || ChannelManagerUrl.StartsWith("http://") || ChannelManagerUrl.StartsWith("ipc://"))
{
m = (IChannelManager)Activator.GetObject(typeof(IChannelManager), ChannelManagerUrl);
}
return m;
});