コード例 #1
0
        /// <summary>
        /// Adds minimal asp.net core middlewares for dependency injection, exception handling and logging. It registers following asp.net core middlewares <see cref="AspNetCoreAutofacDependencyInjectionMiddlewareConfiguration"/>
        /// | <see cref="AspNetCoreExceptionHandlerMiddlewareConfiguration"/>
        /// | <see cref="AspNetCoreLogRequestInformationMiddlewareConfiguration"/>
        /// </summary>
        public static IDependencyManager RegisterMinimalAspNetCoreMiddlewares(this IDependencyManager dependencyManager)
        {
            dependencyManager.RegisterAspNetCoreMiddlewareUsing(aspNetCoreApp =>
            {
                aspNetCoreApp.Use(async(context, next) =>
                {
                    if (context.Request.Path.HasValue)
                    {
                        string path = context.Request.Path.Value;

                        string[] toBeIgnoredPaths = new[] { "/core", "/signalr", "/jobs", "/api" };

                        if (toBeIgnoredPaths.Any(p => path.StartsWith(p, StringComparison.InvariantCultureIgnoreCase)) || path.EndsWith("$batch", StringComparison.InvariantCultureIgnoreCase))
                        {
                            IHttpBodyControlFeature httpBodyControlFeature = context.Features.Get <IHttpBodyControlFeature>();
                            if (httpBodyControlFeature != null)
                            {
                                httpBodyControlFeature.AllowSynchronousIO = true;
                            }
                        }
                    }

                    await next.Invoke();
                });
            });

            dependencyManager.RegisterAspNetCoreMiddlewareUsing(aspNetCoreApp =>
            {
                aspNetCoreApp.UseMiddleware <AddAcceptCharsetToRequestHeadersIfNotAnyAspNetCoreMiddleware>();
            });
            dependencyManager.RegisterOwinMiddleware <AspNetCoreAutofacDependencyInjectionMiddlewareConfiguration>();
            dependencyManager.RegisterAspNetCoreMiddleware <AspNetCoreExceptionHandlerMiddlewareConfiguration>();
            dependencyManager.RegisterAspNetCoreMiddleware <AspNetCoreLogRequestInformationMiddlewareConfiguration>();
            return(dependencyManager);
        }
コード例 #2
0
 public Streams(IHttpBodyControlFeature bodyControl, IFrameControl frameControl)
 {
     _request             = new FrameRequestStream(bodyControl);
     _emptyRequest        = new FrameRequestStream(bodyControl);
     _response            = new FrameResponseStream(bodyControl, frameControl);
     _upgradeableResponse = new WrappingStream(_response);
     _upgradeStream       = new FrameDuplexStream(_request, _response);
 }
コード例 #3
0
ファイル: Streams.cs プロジェクト: finecoder/coder-shelf
 public Streams(IHttpBodyControlFeature bodyControl, IHttpResponseControl httpResponseControl)
 {
     _request             = new HttpRequestStream(bodyControl);
     _emptyRequest        = new HttpRequestStream(bodyControl);
     _response            = new HttpResponseStream(bodyControl, httpResponseControl);
     _upgradeableResponse = new WrappingStream(_response);
     _upgradeStream       = new HttpUpgradeStream(_request, _response);
 }
コード例 #4
0
ファイル: BodyControl.cs プロジェクト: lingku7080/asp.netcore
        public BodyControl(IHttpBodyControlFeature bodyControl, IHttpResponseControl responseControl)
        {
            _requestReader      = new HttpRequestPipeReader();
            _request            = new HttpRequestStream(bodyControl, _requestReader);
            _emptyRequestReader = new HttpRequestPipeReader();
            _emptyRequest       = new HttpRequestStream(bodyControl, _emptyRequestReader);

            _responseWriter      = new HttpResponsePipeWriter(responseControl);
            _response            = new HttpResponseStream(bodyControl, _responseWriter);
            _upgradeableResponse = new WrappingStream(_response);
            _upgradeStream       = new HttpUpgradeStream(_request, _response);
        }
コード例 #5
0
ファイル: HttpRequestStream.cs プロジェクト: wserr/AspNetCore
 public HttpRequestStream(IHttpBodyControlFeature bodyControl, HttpRequestPipeReader pipeReader)
 {
     _bodyControl = bodyControl;
     _pipeReader  = pipeReader;
 }
コード例 #6
0
 public HttpResponseStream(IHttpBodyControlFeature bodyControl, HttpResponsePipeWriter pipeWriter)
     : base(pipeWriter)
 {
     _bodyControl = bodyControl;
     _pipeWriter  = pipeWriter;
 }
コード例 #7
0
 public HttpRequestStream(IHttpBodyControlFeature bodyControl)
 {
     _bodyControl = bodyControl;
     _state       = HttpStreamState.Closed;
 }
コード例 #8
0
 public HttpResponseStream(IHttpBodyControlFeature bodyControl, IISHttpContext context)
 {
     _bodyControl = bodyControl;
     _context     = context;
     _state       = HttpStreamState.Closed;
 }
コード例 #9
0
ファイル: EmptyStream.cs プロジェクト: wserr/AspNetCore
 public EmptyStream(IHttpBodyControlFeature bodyControl)
 {
     _bodyControl = bodyControl;
     _state       = HttpStreamState.Open;
 }
コード例 #10
0
 public HttpResponseStream(IHttpBodyControlFeature bodyControl, IHttpResponseControl httpResponseControl)
 {
     _bodyControl         = bodyControl;
     _httpResponseControl = httpResponseControl;
     _state = HttpStreamState.Closed;
 }
コード例 #11
0
 public FrameResponseStream(IHttpBodyControlFeature bodyControl, IFrameControl frameControl)
 {
     _bodyControl  = bodyControl;
     _frameControl = frameControl;
     _state        = FrameStreamState.Closed;
 }
コード例 #12
0
 public FrameRequestStream(IHttpBodyControlFeature bodyControl)
 {
     _bodyControl = bodyControl;
     _state       = FrameStreamState.Closed;
 }