.NET Ionic.Zip : Compressed or Uncompressed size, or offset exceeds the maximum value

前端 未结 1 1637
野性不改
野性不改 2021-02-14 09:35

I have the following set up:

  • Win2008 server
  • Ionic.zip reference module
  • A seperate drive for building the zip files
  • .NET 4.0
相关标签:
1条回答
  • 2021-02-14 10:20

    The solution revolves around not paying attention to zip file size limitations.

    When using DotNetZip to zip large size files you will get errors like the following in your asp.net coding:

    1. There is not enough space on the disk
    2. Compressed or Uncompressed size, or offset exceeds the maximum value. Consider setting the UseZip64WhenSaving property on the ZipFile instance

    When you see these errors it is probably a good idea to change your asp code by adding the line:

    [yourZipReference].UseZip64WhenSaving = Zip64Option.Always
    

    This will change your code to save the file in the zip64 format, so you may want to make a filesize check before making this change.

    There is another line:

    [yourZipReference].CompressionMethod = CompressionMethod.BZip2;// or CompressionMethod.Deflate or CompressionMethod.None
    

    That will cause the module to use the zip compression method that is appropriate for the situation, but I haven't tested this one yet.

    0 讨论(0)
提交回复
热议问题