示例#1
0
        private void BuildHandler()
        {
            BindingElementCollection      be   = _serviceDispatcher.Binding.CreateBindingElements();
            MessageEncodingBindingElement mebe = be.Find <MessageEncodingBindingElement>();

            if (mebe == null)
            {
                throw new ArgumentException("Must provide a MessageEncodingBindingElement", nameof(_serviceDispatcher.Binding));
            }

            HttpTransportBindingElement tbe = be.Find <HttpTransportBindingElement>();

            if (tbe == null)
            {
                throw new ArgumentException("Must provide a HttpTransportBindingElement", nameof(_serviceDispatcher.Binding));
            }

            var httpSettings = new HttpTransportSettings
            {
                BufferManager             = BufferManager.CreateBufferManager(DefaultMaxBufferPoolSize, tbe.MaxBufferSize),
                OpenTimeout               = _serviceDispatcher.Binding.OpenTimeout,
                ReceiveTimeout            = _serviceDispatcher.Binding.ReceiveTimeout,
                SendTimeout               = _serviceDispatcher.Binding.SendTimeout,
                CloseTimeout              = _serviceDispatcher.Binding.CloseTimeout,
                MaxBufferSize             = tbe.MaxBufferSize,
                MaxReceivedMessageSize    = tbe.MaxReceivedMessageSize,
                MessageEncoderFactory     = mebe.CreateMessageEncoderFactory(),
                ManualAddressing          = tbe.ManualAddressing,
                TransferMode              = tbe.TransferMode,
                KeepAliveEnabled          = tbe.KeepAliveEnabled,
                AnonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher(),
                AuthenticationScheme      = tbe.AuthenticationScheme,
                WebSocketSettings         = tbe.WebSocketSettings.Clone()
            };

            _httpSettings    = httpSettings;
            WebSocketOptions = CreateWebSocketOptions(tbe);

            if (WebSocketOptions == null)
            {
                _replyChannel = new AspNetCoreReplyChannel(_servicesScopeFactory.CreateScope().ServiceProvider, _httpSettings);
                _replyChannelDispatcherTask = _serviceDispatcher.CreateServiceChannelDispatcherAsync(_replyChannel);
            }
        }
        private void BuildHandler()
        {
            var be   = _serviceDispatcher.Binding.CreateBindingElements();
            var mebe = be.Find <MessageEncodingBindingElement>();

            if (mebe == null)
            {
                throw new ArgumentException("Must provide a MessageEncodingBindingElement", nameof(_serviceDispatcher.Binding));
            }

            var tbe = be.Find <HttpTransportBindingElement>();

            if (tbe == null)
            {
                throw new ArgumentException("Must provide a HttpTransportBindingElement", nameof(_serviceDispatcher.Binding));
            }

            var httpSettings = new HttpTransportSettings();

            httpSettings.BufferManager             = BufferManager.CreateBufferManager(DefaultMaxBufferPoolSize, tbe.MaxBufferSize);
            httpSettings.OpenTimeout               = _serviceDispatcher.Binding.OpenTimeout;
            httpSettings.ReceiveTimeout            = _serviceDispatcher.Binding.ReceiveTimeout;
            httpSettings.SendTimeout               = _serviceDispatcher.Binding.SendTimeout;
            httpSettings.CloseTimeout              = _serviceDispatcher.Binding.CloseTimeout;
            httpSettings.MaxBufferSize             = tbe.MaxBufferSize;
            httpSettings.MaxReceivedMessageSize    = tbe.MaxReceivedMessageSize;
            httpSettings.MessageEncoderFactory     = mebe.CreateMessageEncoderFactory();
            httpSettings.ManualAddressing          = tbe.ManualAddressing;
            httpSettings.TransferMode              = tbe.TransferMode;
            httpSettings.KeepAliveEnabled          = tbe.KeepAliveEnabled;
            httpSettings.AnonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher();
            _httpSettings = httpSettings;
            var scope = _servicesScopeFactory.CreateScope();

            _replyChannel      = new AspNetCoreReplyChannel(_servicesScopeFactory.CreateScope().ServiceProvider);
            _channelDispatcher = _serviceDispatcher.CreateServiceChannelDispatcher(_replyChannel);
        }
示例#3
0
 protected override void OnOpening()
 {
     base.OnOpening();
     bufferManager = BufferManager.CreateBufferManager(MaxBufferPoolSize, GetMaxBufferSize());
 }