public bool PassCommand(string filename, string encoding) { var clientChanel = new LocalIpcChannel(); ChannelServices.RegisterChannel(clientChanel, false); var u = "ipc://" + GetChannelName() + "/" + GetObjectName(); IMyPadServer obj = (IMyPadServer)Activator.GetObject(typeof(IMyPadServer), u); try { obj.OpenPage(filename, encoding); return(true); } catch (RemotingException ex) { // Connection refused // error code -2146233087 = 0x80131501 (Failed to connect to server) Trace.WriteLine(ex.ToString()); return(false); } finally { ChannelServices.UnregisterChannel(clientChanel); } }
public void Start() { var name = GetChannelName(); serverChannel = new LocalIpcChannel(name); ChannelServices.RegisterChannel(serverChannel, false); RemotingConfiguration.RegisterWellKnownServiceType( this.GetType(), GetObjectName(), WellKnownObjectMode.SingleCall); }