Pracuję nad utworzeniem funkcji Azure, która pobierze plik POSTed i przetworzy go. Mam podstawową konfigurację i mogę Z powodzeniem pobrać mały plik. Ilekroć POST dużych plików otrzymuję następujący komunikat o błędzie.Jak ustawić MaxReceivedMessageSize dla funkcji Azure
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'
Nie znalazłem żadnej dokumentacji Azure Functions, gdzie ustawić tę właściwość. Czy można zwiększyć maksymalny rozmiar wiadomości dla funkcji Azure?
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);
}
Czy mógłbyś podzielić się tym, jak wygląda twój kod funkcji i function.json? Wygląda to jak komunikat o błędzie WCF, którego nie spodziewałbym się po wywołaniu HttpTrigger, więc jestem ciekawa, jak go odtworzyć i zobaczyć, czy możemy pomóc. – brettsam
Otwarty [wydanie] (https://github.com/Azure/azure-webjobs-sdk-script/issues/1063) w celu śledzenia podobnego błędu. Pomogłoby to, gdybyś mógł udostępnić swój kod tutaj lub na github –
Dodałem zawartość mojego pliku function.json i moje pliki run.csx. Nie zmieniają się zbytnio w stosunku do płyty kotła, ponieważ właśnie eksperymentowałem z Azure Functions, gdy wpadłem na ten problem. – jdehlin