我的应用程序将调用 ahttp trigger来读取 blob 文件。
当文件大小很小(大约 30MB)时,我能够收到来自 http 触发器的响应。当文件大小约为 160MB 时,我的应用程序收到空响应。
仅当 Http 触发器部署在 azure 环境中时才会面临此问题。当从我的本地计算机运行 http 触发器并在我的应用程序中调用本地 http 触发器时,它工作正常。
呼叫应用程序
string WebAddress = "https://MyfunctionApp.azurewebsites.net/api/Report";
//string WebAddress = "http://localhost:7071/api/FIComparisonReport";
string WebServiceUri = string.Format("{0}?groupcode={1}&domicile={2}&legalstructure={3}",
WebAddress,
Uri.EscapeDataString(groupCode),
Uri.EscapeDataString(domicile),
Uri.EscapeDataString(legalStructure));
WebRequest request = WebRequest.Create(WebServiceUri);
request.Method = "GET";
request.Timeout = 360000;
WebResponse response = request.GetResponse();
var encoding = Encoding.UTF8;
string responseText = "";
using (var reader = new System.IO.StreamReader(response.GetResponseStream(), encoding))
{
responseText = reader.ReadToEnd(); // empty for large files
}
HTTP触发
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req,
ILogger log)
{
//read blob to stream
MemoryStream resultSets = myfunc();
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new ByteArrayContent(resultSets.GetBuffer())
};
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
return response;
我在这里缺少什么?
aluckdog
相关分类