gpt4 book ai didi

.net-core - 在 Azure Function 中启用同步 IO

转载 作者:行者123 更新时间:2023-12-04 20:44:23 26 4
gpt4 key购买 nike

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

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: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.



任何帮助将不胜感激!

最佳答案

设置环境变量 FUNCTIONS_V2_COMPATIBILITY_MODEtrue似乎解决了问题,见https://github.com/Azure/azure-functions-host/pull/5286 .

关于.net-core - 在 Azure Function 中启用同步 IO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59379971/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com