예제 #1
0
        /// <summary>
        /// 初始化服务总线(使用WCF服务)
        /// </summary>
        public static void InitializeRemoteBus()
        {
            bizbus = new RemoteBizBus();
            RemoteBizBus     rbizbus    = bizbus as RemoteBizBus;
            string           configuri  = AppSettingConfig.getRemoteUriPath() + "Config";
            string           configPath = AppSettingConfig.getLocalConfigPath();
            BasicHttpBinding bhb        = new BasicHttpBinding("BasicHttpBinding_Service");
            EndpointAddress  epa        = new EndpointAddress(configuri);
            IHostConfig      hostconfig = ChannelFactory <IHostConfig> .CreateChannel(bhb, epa);

            XmlDocument doc = new XmlDocument();

            if (string.IsNullOrEmpty(configPath))
            {
                string configstring = hostconfig.GetConfigString();
                doc.LoadXml(configstring);
            }
            //else
            //{
            //    string file = AppDomain.CurrentDomain.BaseDirectory + @"\namespace DrectSoft.FrameWork.Config";
            //    doc.Load(file);
            //}

            List <ServicePackageInfo> packages = ConfigLoader.GetPackageList(doc.DocumentElement);

            rbizbus.packages = packages;
        }
예제 #2
0
        //internal ServicePackageList packages = new ServicePackageList();      //服务包

        private string getUri(Type t, string key)
        {
            string baseuri = AppSettingConfig.getRemoteUriPath();

            if (string.IsNullOrEmpty(baseuri))
            {
                return("");
            }
            string typename = t.FullName;

            foreach (ServicePackageInfo package in packages)
            {
                foreach (ServiceInfo si in package.Services)
                {
                    if (si.ServiceTypeName == typename && si.Key == key)
                    {
                        return(UriUtil.GetServiceUri(baseuri, package.Name, key));
                    }
                }
            }
            return("");
        }