问题描述
我用SharpZipLib建立在.NET 3.5项目目录的压缩文件,而我创造这样的存档:
I'm using SharpZipLib to create a zip file of a directory in a .NET 3.5 project, and I'm creating the archive like that :
fastZip.CreateZip(Server.MapPath(zipToPath), Server.MapPath(zipFromPath), true, null);
和不设置既不是文件还是文件夹的过滤器。
And that doesn't set neither files nor folders filters.
问题是,结果zip文件只有一些在该目录中,而不是所有的子目录的,说我要COM preSS目录中有3个子目录,生成的压缩文件有其中只有一个。
The problem is that the outcome zip file only has some of the sub-directories in that directory and not all of them, say the directory I want to compress has 3 sub-directories, the resulting zip file has only one of them.
任何想法,为什么会出现这种情况?
Any ideas why is this happening?
推荐答案
在一些调试,我发现这个问题。这个问题的原因是另一个进程正在访问期间将文件添加到它创建的压缩文件,这将导致SharpZipLib进程终止并抛出一个异常,只留下创建压缩文件中的一些文件。
After some debugging I've found the problem.The cause of the issue is that another process is accessing the created zip file during adding files to it, which causes the SharpZipLib process to terminate and throw an exception, leaving the created zip file with only some of the files.
有关更多信息,请阅读我的How要知道哪些进程正在使用ASP.NET下的文件?的问题。
For more please read my How to know which processes is using a file under ASP.NET? question.
这篇关于SharpZipLib只有COM pressing一些目录的子目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!