0

I am getting "Offset to Central Directory cannot be held in an Int64" exception while using ZipArchive in .NET CORE. 

NOTE: I am not getting it in my developement machine (Windows 7), but getting it in production server. (Windows Server 2016). Please help. 

Thanks,

Kannan. 

Kannan Mohan
  • 67
  • 1
  • 11
  • 1
    Can you open the ZIP file from Windows Explorer on the production server? – Matthew Watson Sep 28 '18 at 12:52
  • If you search with that error message you'll find various duplicate errors. In most cases ZipArchive was used to open the wrong type of file. `ZipArchive` only works with ZIP files. It won't work with GZip or 7z. In other cases the file itself is corrupt – Panagiotis Kanavos Sep 28 '18 at 12:56
  • @MatthewWatson: Yes. I am able to open it in Windows explorer. – Kannan Mohan Sep 28 '18 at 13:18
  • @PanagiotisKanavos: I am using to compress from Windows Explorer (Right click -> Send to -> Compress....) options. I am not using any other software to zip it. BTW, The same code works in my local developement. It shows the error in the "title" only on the AWS Server running Windows server 2016. And i am using asp.net core. – Kannan Mohan Sep 28 '18 at 13:20
  • None of which means anything if the file is corrupt. Perhaps it was corrupted when you uploaded it? Have you tried opening and testing *the uploaded* file? Opening a zip may work even for corrupted files as long as the list of contents is available. *Extracting* or testing the zip will show if there are any errors – Panagiotis Kanavos Sep 28 '18 at 13:22
  • I am uploading the zip files along with other .txt files. And handling the streams in memory instead of Extracting. [I will extract it in server for troubleshooting and let you know the result, but why it is working on my development machine is still a mystery to me] – Kannan Mohan Sep 28 '18 at 13:32

1 Answers1

2

This is because Aws API Gateway. Sorry for not mentioning it. If i skip API Gateway and hit my endpoint through the load balancer i can send the zip files without any issues.

Kannan Mohan
  • 67
  • 1
  • 11