在Azure功能中启用同步IO [英] Enable Synchronous IO in Azure Function

查看:127
本文介绍了在Azure功能中启用同步IO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个目标为netcoreapp3.0的HTTPTriggered Azure函数,该函数正在运行GraphQL .NET服务器. GraphQL .NET要求将AllowSynchronousIO设置为true,但是我不知道如何为Azure函数执行此操作.我尝试实现自己的Startup类,该类扩展了FunctionsStartup,并在Configure方法中添加了以下代码,但是没有运气.

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);
    });

我收到的错误消息是:

发生未处理的主机错误.

An unhandled host error has occurred.

Microsoft.AspNetCore.Server.Kestrel.Core:同步操作是 不允许的.调用WriteAsync或将AllowSynchronousIO设置为true.

Microsoft.AspNetCore.Server.Kestrel.Core: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.

任何帮助将不胜感激!

推荐答案

将环境变量FUNCTIONS_V2_COMPATIBILITY_MODE设置为true似乎可以解决问题,请参见

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.

这篇关于在Azure功能中启用同步IO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆