I am building a HTTPTriggered Azure Function, targeting netcoreapp3.0, that is running a GraphQL .NET server. GraphQL .NET requires that AllowSynchronousIO
is set to true
, but I can't figure out how to do that for a Azure Function. I have tried implementing my own Startup
class that extends FunctionsStartup
and added the below code in the Configure
method with no luck.
builder.Services
.AddOptions<KestrelServerOptions>()
.Configure<IConfiguration>((settings, configuration) =>
{
settings.AllowSynchronousIO = true;
configuration.Bind(settings);
});
The error message I get is:
An unhandled host error has occurred.
Microsoft.AspNetCore.Server.Kestrel.Core: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
Any help would be greatly appreciated!
Setting the environment variable FUNCTIONS_V2_COMPATIBILITY_MODE
to true
seems to solve the issue, see https://github.com/Azure/azure-functions-host/pull/5286.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With