0

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:

enter image description here

But the image itself is never fully loaded:

sometimes it loads just a little bit:

enter image description here

sometimes a bit more:

enter image description here

But never the full image. Looks like it interrupts for whatever reason and just sends whatever got into the initial buffer.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Bashir Magomedov
  • 2,841
  • 4
  • 28
  • 44

1 Answers1

0

Thanks to @Athanasios - the issue is not related to the File response. I wasn't reading the S3 stream properly. The error has gone after fixing it.

Bashir Magomedov
  • 2,841
  • 4
  • 28
  • 44