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>pull/18855/head
parent
b6ca033e53
commit
55284bd0b0
|
@ -428,6 +428,20 @@ If you have trouble with <xref:System.IO.TextWriter> 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), <xref:System.Xml.Serialization.XmlSerializer>, and <xref:System.Runtime.Serialization.DataContractSerializer> 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.
|
||||
|
||||
<xref:System.Text.Json> 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 <xref:Microsoft.AspNetCore.Mvc.MvcOptions.SuppressOutputFormatterBuffering> 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.
|
||||
|
|
Loading…
Reference in New Issue