示例代码:
Using Zip As ZipFile = New ZipFile()
Zip.AddFile("E:\Projects\HOPS\HOPS v1.56\Website\Photos\Pubs.zip")
Zip.MaxOutputSegmentSize = 20 * 1024 * 1024
Zip.TempFileFolder = "E:\Temp\Photos\Temp"
Zip.Save("E:\Temp\Photos\Archive.zip")
End Using
生成以下错误消息:
拒绝访问该路径。
注释掉Zip.MaxOutputSegmentSize行,代码可以生成单个zip文件。当它失败时,它设法创建文件.z01文件。我不认为这是目标文件夹上的权限问题,因为我已经给予“Everyone”完全访问权限以尝试使其工作,并且当不尝试分解为20MB块时它能够创建它
完整的错误消息是:
[UnauthorizedAccessException:拒绝访问路径。]
System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath) +10556971 System.IO.File.Move(String sourceFileName,String destFileName)+351
Ionic.Zip.ZipSegmentedStream.TruncateBackward(UInt32 diskNumber,Int64 偏移)+694 Ionic.Zip.ZipEntry.Write(Stream s)+1302
Ionic.Zip.ZipFile.Save()+1162 Ionic.Zip.ZipFile.Save(String fileName)+366 PhotoImport.Page_Load(Object sender,EventArgs e)in E:\ Projects \ HOPS \ HOPS v1.56 \ Website \ Pubs \ PhotoImport.aspx.vb:48
System.EventHandler.Invoke(Object sender,EventArgs e)+0
System.Web.UI.Control.OnLoad(EventArgs e)+132
System.Web.UI.Control.LoadRecursive()+66
System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint) 2428
稍后 - 从Process Monitor获取更多信息:
嗯,为什么要写入该文件夹呢?w3wp.exe CreateFile C:\ Windows \ System32 \ inetsrv ACCESS DENIED