From 309b2076869f8f97c3f8b6c6bc8e34318df16bf5 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 13 Sep 2019 09:33:54 +0100 Subject: [PATCH] Add hosting bug workaround --- samples/Sample.Server/Startup.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/samples/Sample.Server/Startup.cs b/samples/Sample.Server/Startup.cs index 08fdb76..e6c79c6 100644 --- a/samples/Sample.Server/Startup.cs +++ b/samples/Sample.Server/Startup.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -34,6 +35,13 @@ public void ConfigureServices(IServiceCollection services) // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + // Workaround for https://github.com/aspnet/AspNetCore/issues/13470 + app.Use((context, next) => + { + context.Features.Get().MaxRequestBodySize = null; + return next.Invoke(); + }); + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage();