Exemple #1
0
        /// <summary>
        /// Fac
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static ChannelFactory <T> Fac <T>() where T : IWcf
        {
            ChannelFactory <T> fac = new ChannelFactory <T>(WcfEndpoint.Binding);

            WcfEndpoint.SetClientBehavior(fac);
            return(fac);
        }
Exemple #2
0
        /// <summary>
        /// 获取终结点
        /// </summary>
        /// <param name="p_strProxyName"></param>
        /// <returns></returns>
        private static System.ServiceModel.EndpointAddress EndpointAddress(string proxyName, string bizTypeName)
        {
            string          strAddr = null;
            EndpointAddress objAddr = null;

            try
            {
                if (MiddleServers == null || MiddleServers.Count == 0)
                {
                    //MiddleServers.Add(DefaultMidderSvr());
                    WcfEndpoint.GetMiddleServers();
                }
                // 地址
                strAddr = Function.LocalSettingValue("Service", bizTypeName, proxyName);

                // 基类服务
                if (string.IsNullOrEmpty(strAddr))
                {
                    if (proxyName.Equals("ProxyUpdate"))    // 自动更新服务
                    {
                        strAddr = @"wcf.console/update.svc";
                        objAddr = new EndpointAddress(new Uri(Function.GetUpdateXmlValue("wcfAddress") + strAddr));
                    }
                    else
                    {
                        if (proxyName.Equals("ProxyLogin"))
                        {
                            strAddr = @"wcf.console/login.svc";
                        }
                        else if (proxyName.Equals("ProxyCommon"))
                        {
                            strAddr = @"wcf.comm/common.svc";
                        }
                        else if (proxyName.Equals("ProxyEntityFactory"))
                        {
                            strAddr = @"wcf.comm/entityfactory.svc";
                        }
                        objAddr = new EndpointAddress(new Uri(MiddleServers[0] + strAddr));
                        GlobalAppConfig.MidderServerIP = MiddleServers[0];
                    }
                }
                else
                {
                    objAddr = new EndpointAddress(new Uri(MiddleServers[0] + strAddr));
                    GlobalAppConfig.MidderServerIP = MiddleServers[0];
                }
            }
            catch
            {
            }
            finally
            {
                strAddr = null;
            }
            return(objAddr);
        }