c# - 使用 Ionic.Zip.ZipFile 将文件添加到 zip 时出错
问题描述
我收到一个错误:System.ArgumentException:'已添加具有相同键的项目。尝试将服务器中的文件添加到 zipfile 时出现此错误。
public ActionResult DownloadStatements(string[] years, string[] months, string[] radio, string[] emails, string acctNum)
{
List<string> manypaths = (List<string>)TempData["temp"];
using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
{
zip.AddFiles(manypaths, @"\" + DateTime.Now.ToFileTime());
MemoryStream output = new MemoryStream();
zip.Save(output);
return File(output.ToArray(), "application/zip");
}
}
我在 "zip.AddFiles(manypaths, @"" + DateTime.Now.ToFileTime()) 行中收到错误;每个文件都来自服务器,它们是 pdfs。路径文件如下所示:\\ftp- RTMT01\PDF_STORAGE\03_31_2017\Deposit\123_Deposit_03_31_2017_1.pdf”。这些都不是重复的,所以我不明白这个错误信息。现在用了大约2天。
解决方案
推荐阅读
- python - 如何从 Python 打印 A5 大小的 Word 文档?
- python - 如何保留 NaN 而不是在数据透视表中填充零?
- python - 如何重置 Python Browser-Mob-Proxy 模块使用的 har 文件?
- python - 可变大小的向量作为keras的输入?
- c++ - 如何重载作为参数传递给C++模板类的基类方法?
- csv - 如何让 CSV 在 RevitPythonShell 中工作?
- java - 使用 Spring JDBCTemplate 更新 ResultSet
- python - 使用特定标准从 Pandas DataFrame 中删除行?
- node.js - 如何仅使用 tensorflow 和 nodejs 制作自定义对象检测模型(cocossd)?
- authorize.net - 沙箱中的 accept.js - E_WC_21:用户身份验证失败