[英]Azure function (out of process) HTTP Trigger Post request Data limitation
This is an issue with Azure functions 4x (out of process)这是 Azure 函数 4x(进程外)的问题
I am trying to Post a data that is more than 4 MB (4096 Bytes) to the Azure function using HTTP Trigger.我正在尝试使用 HTTP 触发器将超过 4 MB(4096 字节)的数据发布到 Azure function。
It is timing out.超时了。 Following is my code in Azure function
以下是我在 Azure function 中的代码
[Function("HttpTriggerCSharp")]
public async Task<HttpResponseData> HttpTriggerCSharp(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req,
FunctionContext executionContext)
{
HttpResponseData response = HttpResponseData.CreateResponse(req);
string requestBody = String.Empty;
using (StreamReader streamReader = new StreamReader(req.Body))
{
requestBody = await streamReader.ReadToEndAsync();
}
return response;
}
I am using Postman as client with following configuration:我使用 Postman 作为具有以下配置的客户端:
Postman configuration Postman配置
The test file of 4 MB 4 MB的测试文件
I checked the Microsoft doc https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp我检查了 Microsoft 文档https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp
It refers to 100 MB limitation.它指的是 100 MB 的限制。 Please let me know, what mistake I am doing?
请让我知道,我在做什么错误?
The above functionality works with Azure functions in-process (3x).上述功能适用于 Azure 进程中函数 (3x)。
The Azure Function v4 is in Preview Mode and is not fully supported and approved for the production use . Azure Function v4 处于预览模式,未完全支持和批准用于生产。 Moreover it only support the latest versions of .NET, Javascript and Java. Check this language support for more information.
此外,它仅支持最新版本的 .NET、Javascript 和 Java。查看此语言支持以获取更多信息。
We can't directly migrate from Azure Function 3.x to 4.x because other app setting changes and changes to your function code may be required.我们无法直接从 Azure Function 3.x 迁移到 4.x,因为可能需要更改其他应用程序设置并更改您的 function 代码。
Check this for more infromation How to target Azure Functions runtime versions .检查此以获取更多信息如何定位 Azure 函数运行时版本。
To solve this problem try migrating the function app from 3.x to 4.x.要解决此问题,请尝试将 function 应用程序从 3.x 迁移到 4.x。 To migrate function from 3.x to 4.x, follow the following two steps:
要将 function 从 3.x 迁移到 4.x,请执行以下两个步骤:
Set the FUNCTIONS_EXTENSION_VERSION
application setting to ~4
with the following Azure CLI command:使用以下 Azure CLI 命令将
FUNCTIONS_EXTENSION_VERSION
应用程序设置设置为~4
:
az functionapp config appsettings set --settings FUNCTIONS_EXTENSION_VERSION=~4 -n <APP_NAME> -g <RESOURCE_GROUP_NAME>
For Windows function apps, the runtime requires .NET 6.0 to be enabled with the following Azure CLI command:对于 Windows function 应用程序,运行时需要使用以下 Azure CLI 命令启用 .NET 6.0:
az functionapp config set -.net-framework-version v6.0 -n <APP_NAME> -g <RESOURCE_GROUP_NAME>
Note that Azure Functions 4.x enforces minimum version requirements for extensions.请注意,Azure Functions 4.x 强制执行扩展的最低版本要求。 And Azure Functions 4.x requires the
Microsoft.NET.Sdk.Functions
extension be at least 4.0.0
. Azure Functions 4.x 要求
Microsoft.NET.Sdk.Functions
扩展至少为4.0.0
。
Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request.无论 function 应用程序超时设置如何,230 秒是 HTTP 触发 function 响应请求所需的最长时间。 If it exceeds this you get a timeout error.
如果超过此值,则会出现超时错误。
Check this Function app timeout duration documentation for more information.查看此Function 应用超时持续时间文档以获取更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.