コード例 #1
0
        public static BindingProperties GetConfigBindingProperty()
        {
            BindingProperties retValue = new BindingProperties(SecurityMode.None,
                MessageCredentialType.Windows, TcpClientCredentialType.Windows, ProtectionLevel.EncryptAndSign,
                MaxConnections, MaxReceivedMessageSize, MaxBufferPoolSize, MaxArrayLength, MaxBytesPerRead,
                MaxDepth, MaxStringContentLength, 262144,
                OpenTimeout, CloseTimeout, ReceiveTimeout, SendTimeout);

            return retValue;
        }
コード例 #2
0
        public static NetTcpBinding CreateNetTcpBinding(BindingProperties bindingProperties)
        {
            NetTcpBinding tcpBinding = new NetTcpBinding(bindingProperties.SecurityMode, false);

            tcpBinding.Security.Message.ClientCredentialType = bindingProperties.MessageCredentialType;
            tcpBinding.Security.Transport.ClientCredentialType = bindingProperties.TcpClientCredentialType;
            tcpBinding.Security.Transport.ProtectionLevel = bindingProperties.ProtectionLevel;

            tcpBinding.MaxConnections = bindingProperties.MaxConnections;
            tcpBinding.MaxReceivedMessageSize = bindingProperties.MaxReceivedMessageSize;
            tcpBinding.MaxBufferPoolSize = bindingProperties.MaxBufferPoolSize;

            tcpBinding.ReaderQuotas.MaxArrayLength = bindingProperties.MaxArrayLength;
            tcpBinding.ReaderQuotas.MaxBytesPerRead = bindingProperties.MaxBytesPerRead;
            tcpBinding.ReaderQuotas.MaxDepth = bindingProperties.MaxDepth;
            tcpBinding.ReaderQuotas.MaxStringContentLength = bindingProperties.MaxStringContentLength;

            //not allowed by partially trusted
            //tcpBinding.MaxBufferSize = 262144;							//256KB default is 65,536 bytes

            tcpBinding.OpenTimeout = bindingProperties.OpenTimeout;
            tcpBinding.CloseTimeout = bindingProperties.CloseTimeout;
            tcpBinding.ReceiveTimeout = bindingProperties.ReceiveTimeout;
            tcpBinding.SendTimeout = bindingProperties.SendTimeout;

            return tcpBinding;
        }
コード例 #3
0
 public Binding CreateBinding(BindingProperties ps)
 {
     return m_CreateBindingFunc.Invoke(ps);
 }
コード例 #4
0
        public static NetNamedPipeBinding CreateNetNamedPipeBinding(BindingProperties bindingProperties)
        {
            NetNamedPipeBinding binding = (bindingProperties.SecurityMode == SecurityMode.None ?
                new NetNamedPipeBinding(NetNamedPipeSecurityMode.None) : new NetNamedPipeBinding(NetNamedPipeSecurityMode.Transport));

            binding.Security.Transport.ProtectionLevel = bindingProperties.ProtectionLevel;

            binding.MaxConnections = bindingProperties.MaxConnections;
            binding.MaxReceivedMessageSize = bindingProperties.MaxReceivedMessageSize;
            binding.MaxBufferPoolSize = bindingProperties.MaxBufferPoolSize;

            binding.ReaderQuotas.MaxArrayLength = bindingProperties.MaxArrayLength;
            binding.ReaderQuotas.MaxBytesPerRead = bindingProperties.MaxBytesPerRead;
            binding.ReaderQuotas.MaxDepth = bindingProperties.MaxDepth;
            binding.ReaderQuotas.MaxStringContentLength = bindingProperties.MaxStringContentLength;

            //not allowed by partially trusted
            //tcpBinding.MaxBufferSize = 262144;							//256KB default is 65,536 bytes

            binding.OpenTimeout = bindingProperties.OpenTimeout;
            binding.CloseTimeout = bindingProperties.CloseTimeout;
            binding.ReceiveTimeout = bindingProperties.ReceiveTimeout;
            binding.SendTimeout = bindingProperties.SendTimeout;

            return binding;
        }