Ejemplo n.º 1
0
        /// <summary>
        /// 解析XML格式配置文件中的服务配置信息,并注册到server中。
        /// </summary>
        /// <param name="server"></param>
        /// <param name="xmlCfgFile"></param>
        public static void RegisterServices(RPCServer server, string xmlCfgFile = null)
        {
            if (string.IsNullOrEmpty(xmlCfgFile))
            {
                xmlCfgFile = Assembly.GetExecutingAssembly().Location + ".config";

                if (!File.Exists(xmlCfgFile))
                {
                    xmlCfgFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "",
                                              "dotNettyRPC.config");
                }
            }

            foreach (var s in ParseXmlConfig(xmlCfgFile))
            {
                server.RegisterService(s.Interface, s.Service);
            }
        }
Ejemplo n.º 2
0
 public ServerHandler(RPCServer rPCServer)
 {
     _rpcServer = rPCServer;
 }