我正致力于创建一个Azure函数,该函数将接收一个POSTed文件并对其进行处理。我有基础设置,我可以成功发布一个小文件。每当我发布一个大文件时,我都会收到以下错误消息。
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'
我还没有找到有关设置该属性的Azure文档的任何文档。是否可以增加Azure功能的最大邮件大小?
修改
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);
}
答案 0 :(得分:-1)
只是一个想法 - 你会考虑将文件内容帖子拆分成类似天蓝色的blob,然后将链接发布到文件(可以通过基于计时器的链接保护)让你的azure函数从那里抓取它?通常的做法是从主要邮件请求中拆分大文件上载,这不是为处理大文件而优化的。