我正在使用Azure Functions,偶然发现了一个问题。当从外部源请求大量数据时,似乎流已关闭。我已简化了该示例,使其尽可能简单,将在其下静默失败并返回500。静默表示我可以看到的Application Insights中没有错误,也没有办法知道问题。
这在本地用作天蓝色函数。
可读取的数据是否受到某种限制?它不需要占用太多内存(本地内存约为70mb)。因此,在过去两天中,我的头真的撞到了墙上。任何帮助表示赞赏!
[FunctionName("FeedDownloads")]
public HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get" )]HttpRequestMessage req,
ILogger log)//, [FromQuery]string format = "", [FromQuery]bool debug = false)
{
System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("{large 1.5GB gzipped file}");
webRequest.AutomaticDecompression = System.Net.DecompressionMethods.GZip;
var webRequestResponse = webRequest.GetResponse();
var res = req.CreateResponse(HttpStatusCode.OK);
res.Content = new StreamContent(webRequestResponse.GetResponseStream());
res.Content.Headers.ContentType = new MediaTypeHeaderValue(webRequestResponse.ContentType);
return res;
}
[不管功能应用程序超时设置如何,HTTP触发的功能最多可以花费230秒来响应请求。这是因为Azure负载平衡器的默认空闲超时。 Azure负载平衡器的默认空闲超时设置为四分钟。通常,这是Web请求的合理响应时间限制。