.NET Ionic.Zip:压缩或未压缩的大小,或偏移量超过最大值 [英] .NET Ionic.Zip : Compressed or Uncompressed size, or offset exceeds the maximum value

查看:655
本文介绍了.NET Ionic.Zip:压缩或未压缩的大小,或偏移量超过最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行了以下设置:


  • Win2008服务器

  • Ionic.zip参考模块

  • 用于构建zip文件的单独驱动器

  • .NET 4.0

  • Win2008 server
  • Ionic.zip reference module
  • A seperate drive for building the zip files
  • .NET 4.0

该Web应用程序可即时生成zip软件包,并允许客户端下载该软件包。

The web app builds zip packages, on the fly, and allows the client to download the package.

此系统运行良好...现在。

This system has worked wonderfully... until now.

最近,我们添加了一些较大的文件(2GB至11GB),所有这些文件都必须打包在一个软件包中,然后才能下载到客户端。最初,我将这个系统设置为全部发生在C:(一个错误)上。立即开始,尤其是使用较大文件时,我开始收到磁盘上没有足够的空间错误。我要做的第一件事是将系统移至100GB单独驱动器(K :)上。现在,这些文件已在Intranet上发布到生产环境中了,我仍然遇到这些错误。

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.


  1. 我有一个计划要清理的任务夜间驱动器,所以即使在100GB的速度下,我也不会出现错误

  2. C:和K:都有足够的空间

  3. 我尚不知道是C :(一个未知的临时文件夹?)还是K:正在填充
  4. UPDATE-查看事件日志,它是K:正在填满,但是当我检查时它还不完整...所以我假设是临时文件问题...或??

  1. I have a task scheduled that cleans up the drive nightly, so even at 100GB I should not be getting the errors
  2. Both the C: and the K: have plenty of room
  3. I do not yet know if it is the C: (an unknown temp folder??) or the K: that is filling up
  4. 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?

编辑------ -----------------

我认为我所说的压缩方法可能有些问题取出文件大小。我现在看到类似的其他错误:

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:


压缩或未压缩大小,或偏移量超过最大值。考虑在ZipFile实例上设置UseZip64WhenSaving属性。

Compressed or Uncompressed size, or offset exceeds the maximum value. Consider setting the UseZip64WhenSaving property on the ZipFile instance.

我尝试添加 zip.CompressionMethod = Zip64Option.AsNecessary 行,认为zip64是必需的,但随后出现错误不支持的压缩方法。我不确定从这里获得这些新信息。我以为ZipDotNet会处理所有这一切。

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.

更多编辑---------------- ----

有一段时间,我意识到常规zip的大小限制为4GB。 Zip64具有更大的大小限制。

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.

我在代码中添加了 zip.UseZip64WhenSaving = True 行,这似乎已经解决了该问题。到目前为止,还没有问题。

I added the line zip.UseZip64WhenSaving = True to my code and that seems to have fixed the issue. So far, no issues.

推荐答案

解决方案围绕着不注意zip文件大小限制的问题展开。

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

使用DotNetZip压缩大型文件时,在asp.net编码中会出现类似以下的错误:

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


  1. 磁盘上没有足够的空间

  2. 压缩或未压缩的大小,或者偏移量超过最大值。考虑在ZipFile实例上设置UseZip64WhenSaving属性

当您看到这些错误时,最好通过添加以下代码来更改ASP代码该行:

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

[yourZipReference].UseZip64WhenSaving = Zip64Option.Always

这将更改您的代码以zip64格式保存文件,因此您可能需要在进行此更改之前进行文件大小检查。

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.

还有另一行:

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

这将导致模块使用一种适用于这种情况的zip压缩方法,但我尚未对此进行测试。

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.

这篇关于.NET Ionic.Zip:压缩或未压缩的大小,或偏移量超过最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆