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"] = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings["ServerPort"].Value.ToString(); RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off; ChannelServices.RegisterChannel(new TcpChannel(Convert.ToInt32(props["port"])), false); } catch (Exception ex) { throw new Exception(ex.Message); } } } }