Beispiel #1
0
        public static Binding GetDefaultBinding(string scheme)
        {
            WCFConfigProvider.InitServiceModel();
            if (WCFConfigProvider._serviceModel == null)
            {
                return(null);
            }
            ProtocolMappingElement protocolMappingElement = WCFConfigProvider._serviceModel.ProtocolMapping.ProtocolMappingCollection[scheme];

            if (protocolMappingElement != null)
            {
                string binding = protocolMappingElement.Binding;
                string bindingConfiguration = protocolMappingElement.BindingConfiguration;
                string a;
                if ((a = binding.ToLower()) != null)
                {
                    if (a == "nettcpbinding")
                    {
                        return(new NetTcpBinding(bindingConfiguration));
                    }
                    if (a == "basichttpbinding")
                    {
                        return(new BasicHttpBinding(bindingConfiguration));
                    }
                    if (a == "wshttpbinding")
                    {
                        return(new WSHttpBinding(bindingConfiguration));
                    }
                }
            }
            return(null);
        }
Beispiel #2
0
        private static string GetDefaultServiceBehaviorName(string scheme)
        {
            ProtocolMappingElement protocolMappingElement = WCFConfigProvider._serviceModel.ProtocolMapping.ProtocolMappingCollection[scheme];

            if (protocolMappingElement != null)
            {
                string binding  = protocolMappingElement.Binding;
                string arg_26_0 = protocolMappingElement.BindingConfiguration;
                string a;
                if ((a = binding.ToLower()) != null)
                {
                    if (a == "nettcpbinding")
                    {
                        return("defaultNetTcpServiceBehavior");
                    }
                    if (a == "basichttpbinding")
                    {
                        return("defaulBasicHttpServiceBehavior");
                    }
                    if (a == "wshttpbinding")
                    {
                        return("defaultWSHttpServiceBehavior");
                    }
                    if (a == "webhttpbinding")
                    {
                        return("defaultWebHttpServiceBehavior");
                    }
                }
            }
            return(string.Empty);
        }
Beispiel #3
0
        public static Binding GetBindingByProtocolMapping(Uri address)
        {
            ProtocolMappingElement el = ConfigUtil.ProtocolMappingSection.ProtocolMappingCollection[address.Scheme];

            if (el == null)
            {
                return(null);
            }
            return(ConfigUtil.CreateBinding(el.Binding, el.BindingConfiguration));
        }