Azure 函数 - 超出 HTTP 触发器请求长度

Azure Function - HTTP trigger request length exceeded

我正在创建一个小型 azure 函数 - HTTP 触发器,托管在 Azure 云上。它的主要功能是简单地接收 post 以 CSV 文件作为有效负载的请求。

但是,某些 posted 的文件大于 100mb,这会导致以下异常:

"Exception while executing function -> Exception binding parameter 'req' -> The maximum message size quota for incoming messages (104857600) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

我已尝试 google 我的方式并基于 azure 函数文档 来自微软:"functions-bindings-http-webhook"

据说

The HTTP request length is limited to 100 MB (104,857,600 bytes), and the URL length is limited to 4 KB (4,096 bytes). These limits are specified by the httpRuntime element of the runtime's Web.config file.

然而,我无法在我的解决方案中实际找到 Web.config,所以我认为这并不适用,或者我只是完全离开这里?

该项目是从 Visual Studio 生成的,具有以下相关依赖项和扩展:

  • Microsoft.Net.Sdk.Functions (1.0.24)

  • Azure Functions and Web jobs Tools (15.10.2046.0)

是否有任何方法可以增加接收请求的最大消息大小限制?

App Service editor对你有用吗?

不过,我认为这种做法是有风险的。如果出现网络问题,您很容易收到超时消息。

我建议您将 CSV 上传到 blob 存储中,并为您的函数创建一个 blob 触发器。