using System; using System.Collections; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; using System.Configuration; using System.Runtime.Serialization.Formatters; using Core.Mes.ServerFrameWork; namespace Core.Mes.ServerManager { public class RemotingGate { public RemotingGate() { StartServer(); } public void StartServer() { try { IDictionary props = new Hashtable(); props["port"] = System.Configuration.ConfigurationManager.AppSettings["ServerPort"]; RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off; ChannelServices.RegisterChannel(new TcpChannel(Convert.ToInt32(props["port"] )), false); } catch (Exception ex) { throw new Exception(ex.Message); } } } }