コード例 #1
0
        public ServiceHostStart(string[] serviceNames, IConsoleService[] consoleServices)
        {            
            var runServices = Config.GetServiceConfigList().Where(c => serviceNames.Contains(c.Item.Key)).ToArray();
            //var runServices = Config.GetServiceConfigList();
            
            if (Config.IsConsoleMode)
            {
                foreach (var sc in runServices)
                {
                    Log.Info(sc.Item.Key);
                    Log.Info(string.Format("{0}: {1}", "HostTypeDeclaration", sc.Item.HostTypeDeclaration));
                    Log.Info(string.Format("{0}: {1}", "HostTypeFullname", sc.Item.HostTypeFullname));
                    Log.Info(string.Format("{0}: {1}", "HostTypeAssembly", sc.Item.HostTypeAssembly));
                    Log.Info(string.Format("{0}: {1}", "ContractTypeDeclaration", sc.Item.ContractTypeDeclaration));
                    Log.Info(string.Format("{0}: {1}", "ContractTypeFullname", sc.Item.ContractTypeFullname));
                    Log.Info(string.Format("{0}: {1}", "ContractTypeAssembly", sc.Item.ContractTypeAssembly));
                    Log.Info(string.Format("{0}: {1}", "ServiceAddressPort", sc.Item.ServiceAddressPort));
                    Log.Info(string.Format("{0}: {1}", "EndpointName", sc.Item.EndpointName));
                    Log.Info(string.Format("{0}: {1}", "AuthorizedGroups", sc.Item.AuthorizedGroups));                   
                }

                sr = new ServiceRunner(runServices);   
             
                // console services
                List<IConsoleService> consoleServiceList = new List<IConsoleService>();
                consoleServiceList.AddRange(consoleServices);
                if (consoleServices != null && consoleServices.Any())
                    sr.AddConsoleServices(consoleServiceList);
            }           
        }