コード例 #1
0
        private void ApplyConfiguration(string configurationName)
        {
            NetTcpBindingElement element2 = NetTcpBindingCollectionElement.GetBindingCollectionElement().Bindings[configurationName];

            if (element2 == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidBindingConfigurationName", new object[] { configurationName, "netTcpBinding" })));
            }
            element2.ApplyConfiguration(this);
        }
コード例 #2
0
        public void NetTcpBinding()
        {
            ServiceModelSectionGroup config = (ServiceModelSectionGroup)ConfigurationManager.OpenExeConfiguration("Test/config/netTcpBinding").GetSectionGroup("system.serviceModel");

            NetTcpBindingCollectionElement netTcpBinding = config.Bindings.NetTcpBinding;

            Assert.AreEqual(1, netTcpBinding.Bindings.Count, "count");

            NetTcpBindingElement binding = netTcpBinding.Bindings [0];

            Assert.AreEqual("NetTcpBinding_IHelloWorldService", binding.Name, "Name");
            Assert.AreEqual(TransactionProtocol.OleTransactions, binding.TransactionProtocol, "TransactionProtocol");
            Assert.AreEqual(SecurityMode.Transport, binding.Security.Mode, "Security.Mode");
            Assert.AreEqual(MessageCredentialType.Windows, binding.Security.Message.ClientCredentialType, "Security.Message.ClientCredentialType");
            Assert.AreEqual(ProtectionLevel.EncryptAndSign, binding.Security.Transport.ProtectionLevel, "Security.Transport.ProtectionLevel");
            Assert.AreEqual(TcpClientCredentialType.Windows, binding.Security.Transport.ClientCredentialType, "Security.Transport.ProtectionLevel");
        }
コード例 #3
0
        void ApplyConfiguration(string configurationName)
        {
            NetTcpBindingCollectionElement section = NetTcpBindingCollectionElement.GetBindingCollectionElement();
            NetTcpBindingElement           element = section.Bindings[configurationName];

            if (element == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
                                                                              SR.GetString(SR.ConfigInvalidBindingConfigurationName,
                                                                                           configurationName,
                                                                                           ConfigurationStrings.NetTcpBindingCollectionElementName)));
            }
            else
            {
                element.ApplyConfiguration(this);
            }
        }
コード例 #4
0
ファイル: Utils.cs プロジェクト: baulig/Provcon-Faust
        static BindingCollectionElement CreateCollectionElement(
			string bindingName, IBindingConfigurationElement element)
        {
            switch (bindingName) {
            case "basicHttpBinding": {
                var http = new BasicHttpBindingCollectionElement ();
                http.Bindings.Add ((BasicHttpBindingElement)element);
                return http;
            }
            #if NET_4_5
            case "basicHttpsBinding": {
                var https = new BasicHttpsBindingCollectionElement ();
                https.Bindings.Add ((BasicHttpsBindingElement)element);
                return https;
            }
            #endif
            case "netTcpBinding": {
                var netTcp = new NetTcpBindingCollectionElement ();
                netTcp.Bindings.Add ((NetTcpBindingElement)element);
                return netTcp;
            }
            case "customBinding": {
                var custom = new CustomBindingCollectionElement ();
                custom.Bindings.Add ((CustomBindingElement)element);
                return custom;
            }
            default:
                throw new InvalidOperationException ();
            }
        }