生成Excel报表时无法创建互斥锁

时间:2017-03-10 06:19:24

标签: c# epplus isolatedstorage

我试图使用EPPLUS生成excel报告,该报告有时可能包含大量数据(大约25,000条记录和2.5 - 3MB)。 这在开发环境(Windows Server 2012 R2 Standard)中运行良好,但在部署大型数据集时失败。

抛出异常 - " IsolatedStorageException:无法创建互斥锁。 (来自HRESULT的异常:0x80131464)"。

我将应用程序池标识更改为' LocalSystem'并设置加载用户配置文件 - 是,但它没有解决问题。

堆栈追踪:

[IsolatedStorageException: Unable to create mutex. (Exception from HRESULT: 0x80131464)]
   System.IO.IsolatedStorage.IsolatedStorageFile.Open(String infoFile, String syncName) +0
   System.IO.IsolatedStorage.IsolatedStorageFile.Lock(Boolean& locked) +370
   System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf) +474
   System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf) +35
   MS.Internal.IO.Packaging.SafeIsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, ReliableIsolatedStorageFileFolder folder) +102
   MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName) +276
   MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream() +31
   MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() +383
   MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count) +73
   MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count) +376
   MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count) +108
   MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count) +120
   System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) +224
   System.IO.StreamWriter.Write(String value) +147
   OfficeOpenXml.ExcelWorksheet.UpdateRowCellData(StreamWriter sw) +7885
   OfficeOpenXml.ExcelWorksheet.SaveXml() +1082
   OfficeOpenXml.ExcelWorksheet.Save() +704
   OfficeOpenXml.ExcelWorkbook.Save() +1295
   OfficeOpenXml.ExcelPackage.GetAsByteArray(Boolean save) +144
   OfficeOpenXml.ExcelPackage.GetAsByteArray() +52
   PLM.Report.Reports.ReportViewer.SetExcel(Dictionary`2 args) +1017
   PLM.Report.Reports.ReportViewer.Page_Load(Object sender, EventArgs e) +926
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

0 个答案:

没有答案