From 55284bd0b0f0f14499417527b9a0f750e377969e Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 18 Jun 2020 18:58:44 -0700 Subject: [PATCH] Add a note about output formatter buffering (#18849) * Add a note about output formatter buffering * Update 22-to-30.md * Update 22-to-30.md (#18853) * Update 22-to-30.md * Update 22-to-30.md Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> --- aspnetcore/migration/22-to-30.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aspnetcore/migration/22-to-30.md b/aspnetcore/migration/22-to-30.md index 9abb2dcf92..f3fb5a8d4a 100644 --- a/aspnetcore/migration/22-to-30.md +++ b/aspnetcore/migration/22-to-30.md @@ -428,6 +428,20 @@ If you have trouble with implementations or other st For more information, see [[Announcement] AllowSynchronousIO disabled in all servers (dotnet/AspNetCore #7644)](https://github.com/dotnet/AspNetCore/issues/7644). +### Output formatter buffering + +[Newtonsoft.Json](https://www.newtonsoft.com/json), , and based output formatters only support synchronous serialization. To allow these formatters to work with the [AllowSynchronousIO](https://github.com/dotnet/aspnetcore/issues/7644) restrictions of the server, MVC buffers the output of these formatters before writing to disk. As a result of buffering, MVC will include the Content-Length header when responding using these formatters. + + supports asynchronous serialization and consequently the `System.Text.Json` based formatter does not buffer. Consider using this formatter for improved performance. + +To disable buffering, applications can configure in their startup: + +```csharp +services.AddControllers(options => options.SuppressOutputFormatterBuffering = true) +``` + +Note that this may result in the application throwing a runtime exception if `AllowSynchronousIO` isn't also configured. + ### Microsoft.AspNetCore.Server.Kestrel.Https assembly removed In ASP.NET Core 2.1, the contents of *Microsoft.AspNetCore.Server.Kestrel.Https.dll* were moved to *Microsoft.AspNetCore.Server.Kestrel.Core.dll*. This was a non-breaking update using `TypeForwardedTo` attributes. For 3.0, the empty *Microsoft.AspNetCore.Server.Kestrel.Https.dll* assembly and the NuGet package have been removed.