How to set MaxReceivedMessageSize for Azure functions

I am working on creating an Azure Function that will process the POSTed file and process it. I have basic settings, and I can successfully POST a small file. Whenever I send a large file, I get the following error message.

A ScriptHost error has occurred Exception while executing function: Functions.HttpTriggerCSharp. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'request'. System.ServiceModel: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. Exception while executing function: Functions.HttpTriggerCSharp Executed: 'Functions.HttpTriggerCSharp' (Failed) Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '5fc0eaa2-0159-4185-93e4-57a4b2d4bb7f' 

I could not find the Azure Functions documentation on where to set this property. Is it possible to increase the maximum message size for Azure features?

Edit

function.json

 { "disabled": false, "bindings": [ { "name": "request", "authLevel": "anonymous", "type": "httpTrigger", "direction": "in", "methods": [ "GET", "POST" ], "route": "test" }, { "name": "response", "type": "http", "direction": "out" } ] } 

run.csx

 using System.Net; public static async Task<HttpResponseMessage> Run(HttpRequestMessage request, TraceWriter log) { log.Info($"C# HTTP trigger function processed a request. RequestUri={request.RequestUri}"); // parse query parameter string name = request.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0) .Value; return name == null ? request.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body") : request.CreateResponse(HttpStatusCode.OK, "Hello " + test.Value); } 
+6
source share
1 answer

Just an idea: do you consider splitting the message about the contents of the file into something like azure blob, and then place a link to the file (you can protect it with a timer link) so that your azure function captures it from there? A very common practice is to split large file uploads from the main mail request, which is not optimized for processing a large file.

-1
source

Source: https://habr.com/ru/post/1261402/


All Articles