[英].net core web api File randomly loads only part of the response
I am loading an image from S3 bucket as byte[]
and send it as a response from my asp.net core 3.1 web API controller method. I am loading an image from S3 bucket as
byte[]
and send it as a response from my asp.net core 3.1 web API controller method.
Here is my code:这是我的代码:
public async Task<IActionResult> GetImage(string documentId, int pageId)
{
var imageArray = await _documentService.GetImage(documentId, pageId);
return File(imageArray, "image/png");
}
It works to an extend.它在一定程度上起作用。 The Response is delivered to the client:
响应被传递给客户端:
But the image itself is never fully loaded:但是图像本身永远不会完全加载:
sometimes it loads just a little bit:有时它只加载一点点:
sometimes a bit more:有时更多:
But never the full image.但从来没有完整的形象。 Looks like it interrupts for whatever reason and just sends whatever got into the initial buffer.
看起来它因任何原因而中断,只是将进入初始缓冲区的任何内容发送出去。
Thanks to @Athanasios - the issue is not related to the File response.感谢@Athanasios - 该问题与文件响应无关。 I wasn't reading the S3 stream properly.
我没有正确阅读 S3 stream。 The error has gone after fixing it.
修复后错误消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.