Example #1
0
        public DvcChannelFactory(DvcBindingElement bindingElement, BindingContext context)
            : base(context.Binding)
        {
            // populate members from binding element
            this.maxBufferSize = (int)bindingElement.MaxReceivedMessageSize;
            this.bufferManager = BufferManager.CreateBufferManager(bindingElement.MaxBufferPoolSize, maxBufferSize);

            var messageEncoderElement = context.BindingParameters
                                        .OfType <MessageEncodingBindingElement>()
                                        .SingleOrDefault()
                                        ?? new MtomMessageEncodingBindingElement();

            this.encoderFactory = messageEncoderElement.CreateMessageEncoderFactory();
        }
Example #2
0
        public DvcBinding(int mbMaxRead)
        {
            transport = new DvcBindingElement();
            encoding  = new BinaryMessageEncodingBindingElement();

            const int mb    = 1024 /* kb */ * 1024;
            var       limit = mbMaxRead * mb;

            transport.MaxBufferPoolSize                  = limit;
            transport.MaxReceivedMessageSize             = limit;
            encoding.MaxWritePoolSize                    = limit;
            encoding.ReaderQuotas.MaxBytesPerRead        = limit;
            encoding.ReaderQuotas.MaxStringContentLength = limit;
            encoding.ReaderQuotas.MaxArrayLength         = limit;
        }
Example #3
0
        public DvcChannelListener(DvcBindingElement bindingElement, BindingContext context)
            : base(context.Binding)
        {
            // populate members from binding element
            this.maxBufferSize = (int)bindingElement.MaxReceivedMessageSize;
            this.bufferManager = BufferManager.CreateBufferManager(bindingElement.MaxBufferPoolSize, maxBufferSize);
            this.acceptQueue   = new BlockingCollection <IAsyncDvcChannel>();

            var messageEncoderBindingElement = context.BindingParameters.OfType <MessageEncodingBindingElement>().SingleOrDefault();

            if (messageEncoderBindingElement != null)
            {
                this.encoderFactory = messageEncoderBindingElement.CreateMessageEncoderFactory();
            }
            else
            {
                this.encoderFactory = new MtomMessageEncodingBindingElement().CreateMessageEncoderFactory();
            }

            this.Uri = new Uri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);
        }
 protected DvcBindingElement(DvcBindingElement other)
     : base(other)
 {
 }