Open ramon-garcia opened 4 years ago
I managed to get it working with the code from https://michaelscodingspot.com/the-battle-of-c-to-json-serializers-in-net-core-3/ classes Utf8JsonInputFormatter and Utf8JsonOutputFormatter.
I'm got the same problem. Microsoft disabled by default the synchronous i/o and announced this change here.
I'm planing to migrate to System.Text, but you can use this workaround instead:
public void ConfigureServices(IServiceCollection services)
{
services.Configure<KestrelServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
// If using IIS:
services.Configure<IISServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
// Other services.
}
I think it is better if you don't allow synchronous IO, because it can impact your performance.
You can implement the solution from this PR or the solution from @ramon-garcia which is the kind the same. https://github.com/neuecc/Utf8Json/pull/193/files
Just copy the file to your solution, or some common library and inject this formatter.
When attempting to use Utf8Json formatter with ASP.NET Core 3, the following error appears: