Beispiel #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);
        }
 public AspNetCoreReplyChannel(IServiceProvider serviceProvider, HttpTransportSettings httpSettings)
 {
     _serviceProvider = serviceProvider;
     _httpSettings    = httpSettings;
 }
 public ServerWebSocketTransportDuplexSessionChannel(HttpContext httpContext, WebSocketContext webSocketContext, HttpTransportSettings settings, Uri localVia, IServiceProvider serviceProvider)
     : base(settings, new EndpointAddress(localVia), localVia)
 {
     _httpContext       = httpContext;
     _webSocketContext  = webSocketContext;
     _transportSettings = settings;
     _serviceProvider   = serviceProvider;
 }