Morning,
I have a very interesting situation, when i run my code locally with the IIS express it works great the zip file is downloaded fine. After publishing to AWS Lambda the zip file downloads but is corrupt. I'm trying to understand if its the way in which the controller returns the memory stream or if its an AWS issue. I have submitted a ticket to AWS, can anybody see an issue with my controller that would cause this issue.
Things I've tried
p.s i know I'm going to get crap for my coding style........lol....
I have a very interesting situation, when i run my code locally with the IIS express it works great the zip file is downloaded fine. After publishing to AWS Lambda the zip file downloads but is corrupt. I'm trying to understand if its the way in which the controller returns the memory stream or if its an AWS issue. I have submitted a ticket to AWS, can anybody see an issue with my controller that would cause this issue.
Things I've tried
- result .Seek(0, SeekOrigin.Begin);
- result .Position = 0;
- "application/zip"
- byte[] test = result.ToArray(); and returning the array
p.s i know I'm going to get crap for my coding style........lol....
C#:
[HttpPost("v1/GetReaJetXMLZips")]
public IActionResult GetReaJetXMLZips([FromBody] IEnumerable<JsonRequestModel> JsonRequestModels)
{
try
{
string FileName = string.Concat("ReaJet_", DateTime.Now.ToString("yyyyMMddhhmmss"), ".zip");
MemoryStream result = this._IReaJetPOCImpl.GetReaJetXMLZips(JsonRequestModels);
return File(result, "application/octet-stream", FileName);
}
catch(Exception ex)
{
return BadRequest(ex.Message);
}
}
Attachments
Last edited: