Over the last year I’ve been dabbling in the dark arts of GraphQL. As a web api interface, its easy to consume and utilize, but I consider myself a back end developer first and for most. I have been spending my time learning how to build a GraphQL server implementation utilizing .NET Core with GraphQL.NET. I’ve pulled down the project’s recent code, launched the harness project, and was immediately met with an ASP.NET Core error.
It turns out, starting in .NET Core 3.0, all synchronous operations on the request are turned off by default.
AllowSynchronousIO is a option in each server that enables or disables sync IO APIs like HttpReqeuest.Body.Read, HttpResponse.Body.Write, Stream.Flush, etc.. These APIs have long been a source of thread starvation and application hangs. Starting in 3.0.0-preview3 these are disabled by default. –Chris Ross
If you are seeing this error after upgrading your project to .NET Core 3.0, it is likely you are running on these .NET server implementations.
- Kestrel
- HttpSys
- IIS in-process
- TestServer
Errors can revolve around ReadAsync
, WriteAsync
, and FlushAsync
with outputs similar to what is listed below.
As a temporary workaround, you can set the value of AllowSynchronousIO
in your ConfigureServices
method found in your Startup
class.
It isn’t a great workaround, but it will keep you moving forward. The better solution is to upgrade your libraries and perform all your actions asynchronously. I hope this helped!