问题
I have the following set up:
- Win2008 server
- Ionic.zip reference module
- A seperate drive for building the zip files
- .NET 4.0
The web app builds zip packages, on the fly, and allows the client to download the package.
This system has worked wonderfully... until now.
Recently we added some larger files (2GB to 11GB) that all need to be wrapped up in a package before downloading to the client. Originally I had this system set up to happen all on the C: (a mistake). Right away, especially with the larger sized files, I started getting "There is not enough space on the disk" errors. The first thing I did was to move the system to work on a 100GB seperate drive (K:). Now that these files are released to production on the intranet, I'm still getting these errors.
- I have a task scheduled that cleans up the drive nightly, so even at 100GB I should not be getting the errors
- Both the C: and the K: have plenty of room
- I do not yet know if it is the C: (an unknown temp folder??) or the K: that is filling up
- UPDATE - Looking at the event logs it is the K: that is filling up, but when I check it, it's not full... So I'm assuming a temp file issue... or??
Is there anyone that can shed some light on any of this or advise on troubleshooting what is going on?
EDIT-----------------------
I think there may be something to the compression method I'm calling out for the file size. I'm now seeing other errors coming through that look like:
Compressed or Uncompressed size, or offset exceeds the maximum value. Consider setting the UseZip64WhenSaving property on the ZipFile instance.
I tried adding the line zip.CompressionMethod = Zip64Option.AsNecessary
thinking that zip64 is going to be necessary, but then I got the error Unsupported compression method
. I'm not sure where to go from here with this new information. I thought ZipDotNet would handle all this.
This is getting urgent now that users are attempting to download this files. I'm working on a patch for now as a work around.
MORE EDIT--------------------
There was a kind of DUH moment when I realized that regular zip has a size limit of 4GB. Zip64 has a MUCH larger size limit.
I added the line zip.UseZip64WhenSaving = True
to my code and that seems to have fixed the issue. So far, no issues.
回答1:
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:
- There is not enough space on the disk
- 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.
来源:https://stackoverflow.com/questions/14901652/net-ionic-zip-compressed-or-uncompressed-size-or-offset-exceeds-the-maximum