コード例 #1
0
        public static BasicHttpBinding CreateHttpBindingAndInitialize(string bindingName, WcfTimeout timeout, bool isServerBinding)
        {
            BasicHttpBinding basicHttpBinding = new BasicHttpBinding();

            basicHttpBinding.Name = bindingName;
            basicHttpBinding.MaxBufferPoolSize      = (long)EndpointBuilder.MebiBytes(64);
            basicHttpBinding.MaxBufferSize          = EndpointBuilder.MebiBytes(64);
            basicHttpBinding.MaxReceivedMessageSize = (long)EndpointBuilder.MebiBytes(64);
            if (isServerBinding)
            {
                EndpointBuilder.SetReaderQuotas(basicHttpBinding.ReaderQuotas);
            }
            else
            {
                EndpointBuilder.SetTimeout(basicHttpBinding, timeout);
            }
            return(basicHttpBinding);
        }
コード例 #2
0
        public static NetNamedPipeBinding CreateNamedPipeBindingAndInitialize(string bindingName, WcfTimeout timeout, bool isServerBinding)
        {
            NetNamedPipeBinding netNamedPipeBinding = new NetNamedPipeBinding();

            netNamedPipeBinding.Name = bindingName;
            netNamedPipeBinding.MaxBufferPoolSize      = (long)EndpointBuilder.MebiBytes(64);
            netNamedPipeBinding.MaxBufferSize          = EndpointBuilder.MebiBytes(64);
            netNamedPipeBinding.MaxReceivedMessageSize = (long)EndpointBuilder.MebiBytes(64);
            netNamedPipeBinding.MaxConnections         = 200;
            if (isServerBinding)
            {
                EndpointBuilder.SetReaderQuotas(netNamedPipeBinding.ReaderQuotas);
            }
            else
            {
                EndpointBuilder.SetTimeout(netNamedPipeBinding, timeout);
            }
            return(netNamedPipeBinding);
        }