简体   繁体   English

Azure function (out of process) HTTP Trigger Post request 数据限制

[英]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,请执行以下两个步骤:

  1. 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>
  2. 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.

相关问题 如何使用 HTTP 触发器解析 Azure Function App 中的多部分表单数据? (节点) - How to parse Multi-part form data in an Azure Function App with HTTP Trigger? (NodeJS) 集成http触发器powershell azure Function应用网关 - Integrate http trigger powershell azure Function app with app gateway HTTP 触发器 azure function 从 blob 存储错误获取图像 - HTTP trigger azure function get image from blob storage error Azure http 和博客触发功能无法处理任何大于 4 mb 的消费计划文件 - Azure http and blog trigger functions can't process any file larger than 4 mb on consumption plan 通过 Azure 事件中心触发器 Function 从 Azure 物联网中心处理遥测 - Process Telemetry from Azure IoT Hub via Azure Event Hub Trigger Function HTTP 带有请求正文的 POST - HTTP POST with request body 为什么我的 header 数据从我的 Azure Function Http 从 HttpClient.GetAsync 调用时触发 in.Net 5 - Why is my header data missing from my Azure Function Http Trigger in .Net 5 when calling from HttpClient.GetAsync Azure functions v3 /HTTP trigger functions: Limiting the request body and URL 大小 - Azure functions v3 /HTTP trigger functions : Limiting the request body and URL size VS Code Azure 部署 Python Http 触发器 function 失败 - 未找到 GLIB_2.27 - VS Code Azure deployment of Python Http Trigger function fails - GLIB_2.27 not found 对于 Azure Function HTTP 触发器,我如何设置 CORS 策略“WithExposedHeaders("*")? - For an Azure Function HTTP Trigger how can I set a CORS policy "WithExposedHeaders("*")?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM