Azure 函数 - 超出 HTTP 触发请求长度 [英] Azure Function - HTTP trigger request length exceeded
问题描述
我正在创建一个托管在 Azure 云上的小型 azure 函数 - HTTP 触发器.它的主要功能是简单地接收带有 CSV 文件作为负载的 post 请求.
I am creating a small azure function - HTTP trigger that is hosted on the Azure Cloud. Its main function is to simply receive post requests with a CSV file as payload.
但是,发布的某些文件大于 100mb,这会导致以下异常:
However, some of the files that are posted are larger than 100mb, which results in the following exception:
"执行函数时出现异常 ->异常绑定参数'req'->已超出传入邮件 (104857600) 的最大邮件大小配额.要增加配额,请在适当的绑定元素上使用 MaxReceivedMessageSize 属性.
"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.
我尝试用谷歌搜索我的方式并基于 azure 函数文档来自微软:functions-bindings-http-webhook"
I have tried to google my way and based on the azure function documentation from Microsoft: "functions-bindings-http-webhook"
据说
HTTP 请求长度限制为 100 MB(104,857,600 字节),URL 长度限制为 4 KB(4,096 字节).这些限制由运行时 Web.config 文件的 httpRuntime 元素指定.
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,所以我认为这并不适用,还是我完全不在这儿了?
Yet, I am unable to actually locate the Web.config within my solution, so I expect this is not really applicable or am I just totally off here?
该项目是从 Visual Studio 生成的,具有以下相关依赖项和扩展:
The project is generated from Visual Studio with the following related dependencies and extensions:
Microsoft.Net.Sdk.Functions (1.0.24)
Microsoft.Net.Sdk.Functions (1.0.24)
Azure Functions 和 Web 作业工具 (15.10.2046.0)
Azure Functions and Web jobs Tools (15.10.2046.0)
有没有办法增加接收请求的最大消息大小限制?
Are there any ways to increase the maximum message size limit for the received requests?
推荐答案
应用服务编辑器适合你吗?
但是,我认为这种方法是有风险的.如果出现网络问题,您可以轻松收到超时.
However, I believe this approach is risky. In case of networking issues you can easily receive a timeout.
我建议您将 CSV 上传到 Blob 存储中,并为您的函数创建 Blob 触发器.
I would recommend that you upload your CSVs in a blob storage, and create a blob trigger for your function.
这篇关于Azure 函数 - 超出 HTTP 触发请求长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!