private void ApplyConfiguration(string configurationName)
        {
            NetNamedPipeBindingElement element2 = NetNamedPipeBindingCollectionElement.GetBindingCollectionElement().Bindings[configurationName];

            if (element2 == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidBindingConfigurationName", new object[] { configurationName, "netNamedPipeBinding" })));
            }
            element2.ApplyConfiguration(this);
        }
示例#2
0
        void EnsureBindingRemoved(Configuration config)
        {
            ServiceModelSectionGroup sg = ServiceModelSectionGroup.GetSectionGroup(config);

            if (sg.Bindings.NetNamedPipeBinding.Bindings.ContainsKey(this.DefaultBindingName))
            {
                NetNamedPipeBindingElement element = sg.Bindings.NetNamedPipeBinding.Bindings[this.DefaultBindingName];
                sg.Bindings.NetNamedPipeBinding.Bindings.Remove(element);
            }
            if (sg.Bindings.NetNamedPipeBinding.Bindings.ContainsKey(this.DefaultTransactionalBindingName))
            {
                NetNamedPipeBindingElement element = sg.Bindings.NetNamedPipeBinding.Bindings[this.DefaultTransactionalBindingName];
                sg.Bindings.NetNamedPipeBinding.Bindings.Remove(element);
            }
        }
        void ApplyConfiguration(string configurationName)
        {
            NetNamedPipeBindingCollectionElement section = NetNamedPipeBindingCollectionElement.GetBindingCollectionElement();
            NetNamedPipeBindingElement           element = section.Bindings[configurationName];

            if (element == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
                                                                              SR.GetString(SR.ConfigInvalidBindingConfigurationName,
                                                                                           configurationName,
                                                                                           ConfigurationStrings.NetNamedPipeBindingCollectionElementName)));
            }
            else
            {
                element.ApplyConfiguration(this);
            }
        }
示例#4
0
        void EnsureNetProfileNamedPipeBindingElementBinding(Configuration config)
        {
            ServiceModelSectionGroup sg = ServiceModelSectionGroup.GetSectionGroup(config);

            if (!sg.Bindings.NetNamedPipeBinding.Bindings.ContainsKey(this.DefaultBindingName))
            {
                NetNamedPipeBindingElement bindingConfig;
                bindingConfig = new NetNamedPipeBindingElement(this.DefaultBindingName);
                sg.Bindings.NetNamedPipeBinding.Bindings.Add(bindingConfig);
            }
            if (!sg.Bindings.NetNamedPipeBinding.Bindings.ContainsKey(this.DefaultTransactionalBindingName))
            {
                NetNamedPipeBindingElement bindingConfig;
                bindingConfig = new NetNamedPipeBindingElement(this.DefaultTransactionalBindingName);
                bindingConfig.TransactionFlow = true;
                sg.Bindings.NetNamedPipeBinding.Bindings.Add(bindingConfig);
            }
        }
示例#5
0
        internal static Binding CreateBinding(string type, string xml)
        {
            Binding binding = null;
            StandardBindingElement element = null;

            switch (type)
            {
            case "NetTcpBinding":
                binding = new NetTcpBinding();
                element = new NetTcpBindingElement();
                break;

            case "BasicHttpBinding":
                binding = new BasicHttpBinding();
                element = new BasicHttpBindingElement();
                break;

            case "WSHttpBinding":
                binding = new WSHttpBinding();
                element = new WSHttpBindingElement();
                break;

            case "NetNamedPipeBinding":
                binding = new NetNamedPipeBinding();
                element = new NetNamedPipeBindingElement();
                break;

            case "NetMsmqBinding":
                binding = new NetMsmqBinding();
                element = new NetMsmqBindingElement();
                break;

            default:
                binding = new NetTcpBinding();
                element = new NetTcpBindingElement();
                break;
            }

            Deserialize(xml, element);
            element.ApplyConfiguration(binding);

            return(binding);
        }