// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.Use(async(ctx, next) => { IHttpResponseBodyFeature f = ctx.Features.Get <IHttpResponseBodyFeature>(); f?.DisableBuffering(); await next(); }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapODataRoute("test", "test", GetModel()); }); }
private static void DisableResponseBuffering(HttpContext context) { IHttpResponseBodyFeature responseBodyFeature = context.Features.Get <IHttpResponseBodyFeature>(); if (responseBodyFeature != null) { responseBodyFeature.DisableBuffering(); } }
// For this to be effective it needs to be called before the first write. public void DisableBuffering() { if (ResolveCompressionProvider()?.SupportsFlush == false) { // Don't compress, some of the providers don't implement Flush (e.g. .NET 4.5.1 GZip/Deflate stream) // which would block real-time responses like SignalR. _compressionChecked = true; } else { _autoFlush = true; } _innerBodyFeature.DisableBuffering(); }
/// <summary> /// Disables MVC Buffering /// </summary> private void DisableBuffering() { if (_context == null) { return; } IHttpResponseBodyFeature responseBodyFeature = _context.HttpContext.Features.Get <IHttpResponseBodyFeature>(); if (responseBodyFeature != null) { responseBodyFeature.DisableBuffering(); } }
public override Task ExecuteResultAsync(ActionContext context) { Microsoft.AspNetCore.Http.HttpResponse response = context.HttpContext.Response; response.ContentType = ResultContentType; System.IO.Stream stream = response.Body; IHttpResponseBodyFeature bufferingFeature = context.HttpContext.Features.Get <IHttpResponseBodyFeature>(); if (bufferingFeature != null) { bufferingFeature.DisableBuffering(); } return(_serializer.SerializeAsync <T>(Data, stream)); }
private static void DisableResponseBuffering(HttpContext context) { IHttpResponseBodyFeature bufferingFeature = context.Features.Get <IHttpResponseBodyFeature>(); if (bufferingFeature != null) { bufferingFeature.DisableBuffering(); } //.NET Core 2.2 //IHttpBufferingFeature bufferingFeature = context.Features.Get<IHttpBufferingFeature>(); //if (bufferingFeature != null) //{ // bufferingFeature.DisableResponseBuffering(); //} }
private void DisableResponseBuffering(HttpContext context) { #if !NETCOREAPP2_1 && !NET461 IHttpResponseBodyFeature responseBodyFeature = context.Features.Get <IHttpResponseBodyFeature>(); if (responseBodyFeature != null) { responseBodyFeature.DisableBuffering(); } #else IHttpBufferingFeature bufferingFeature = context.Features.Get <IHttpBufferingFeature>(); if (bufferingFeature != null) { bufferingFeature.DisableResponseBuffering(); } #endif }
public void DisableBuffering() { string acceptEncoding = _context.Request.Headers[HeaderNames.AcceptEncoding]; ICompressor compressor = InitializeCurrentCompressor(acceptEncoding); if (compressor?.SupportsFlush == false) { // Some of the compressors don't support flushing which would block real-time // responses like SignalR. _compressionEnabled = false; _currentCompressor = null; } else { _autoFlushCompressionStream = true; } _responseBodyFeature.DisableBuffering(); }
public void DisableBuffering() { inner.DisableBuffering(); }
public void DisableBuffering() { _responseBodyFeature.DisableBuffering(); }
public void DisableBuffering() => _initialResponseFeature.DisableBuffering();
void IHttpResponseBodyFeature.DisableBuffering() => _originalResponseBodyFeature.DisableBuffering();