示例#1
0
        private async void OnMessageReceived(StreamSocket socket)
        {
            _logger.Trace("Pipeline => HttpServer.OnMessageReceived");
            _service = this;

            try
            {
                HttpContextContent socketContext = new HttpContextContent(socket);
                HttpContext        context       = await socketContext.ReadAsHttpContextAsync();

                context.Application = ApplicationInfo;
                context.Items       = new KeyValuePair <string, object>();
                context.Response.Headers.Add("X-Powered-By", _poweredBy);

                _moduleManager.InvokeAsync(context, SendResponseAsync);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
        private async void OnMessageReceived(StreamSocket socket)
        {
            _logger.Trace("Pipeline => HttpServer.OnMessageReceived");
            _service = this;

            try
            {
                HttpContextContent socketContext = new HttpContextContent(socket);
                HttpContext context = await socketContext.ReadAsHttpContextAsync();

                context.Application = ApplicationInfo;
                context.Items = new KeyValuePair<string, object>();
                context.Response.Headers.Add("X-Powered-By", _poweredBy);

                _moduleManager.InvokeAsync(context, SendResponseAsync);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }