diff --git a/examples/ASP.NET Core 3/ASP.NET Core 3 - VS2019/Startup.cs b/examples/ASP.NET Core 3/ASP.NET Core 3 - VS2019/Startup.cs index f829224e..448b36bb 100644 --- a/examples/ASP.NET Core 3/ASP.NET Core 3 - VS2019/Startup.cs +++ b/examples/ASP.NET Core 3/ASP.NET Core 3 - VS2019/Startup.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -41,17 +42,23 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) } app.UseHttpsRedirection(); app.UseStaticFiles(); - app.UseRouting(); - app.UseAuthorization(); + // needed for ${aspnet-request-posted-body} with an API Controller. Must be before app.UseEndpoints + app.Use(async (context, next) => { + context.Request.EnableBuffering(); + await next(); + }); + app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); + + } } }