448976e1922602faabf54d539fcd144ff18da77f.svn-base 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections;
  3. using System.Runtime.Remoting;
  4. using System.Runtime.Remoting.Channels;
  5. using System.Runtime.Remoting.Channels.Tcp;
  6. using System.Configuration;
  7. using System.Runtime.Serialization.Formatters;
  8. using Core.Mes.ServerFrameWork;
  9. namespace Core.Mes.ServerManager
  10. {
  11. public class RemotingGate
  12. {
  13. ServerConfigure _servConf = null;
  14. public RemotingGate(ServerConfigure _servCfg)
  15. {
  16. _servConf = _servCfg;
  17. StartServer();
  18. }
  19. public void StartServer()
  20. {
  21. //try
  22. {
  23. IDictionary props = new Hashtable();
  24. props["port"] = _servConf.ServerPort;
  25. RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
  26. ChannelServices.RegisterChannel(new TcpChannel(Convert.ToInt32(props["port"])), false);
  27. }
  28. /*catch (Exception ex)
  29. {
  30. throw new Exception(ex.Message, ex);
  31. }*/
  32. }
  33. }
  34. }