C# 生成Excel报表时无法创建互斥体
我正在尝试使用EPPLUS生成一个excel报告,其中有时可能包含大量数据(大约25000条记录和2.5-3MB)。 这在开发环境(Windows Server 2012 R2标准)中运行良好,但在部署大型数据集时失败 它引发异常-“IsolatedStorageException:无法创建互斥锁。(来自HRESULT的异常:0x80131464)” 我将应用程序池标识更改为“LocalSystem”,并将Load User profile设置为-True,但这并没有解决问题 堆栈跟踪:C# 生成Excel报表时无法创建互斥体,c#,epplus,isolatedstorage,C#,Epplus,Isolatedstorage,我正在尝试使用EPPLUS生成一个excel报告,其中有时可能包含大量数据(大约25000条记录和2.5-3MB)。 这在开发环境(Windows Server 2012 R2标准)中运行良好,但在部署大型数据集时失败 它引发异常-“IsolatedStorageException:无法创建互斥锁。(来自HRESULT的异常:0x80131464)” 我将应用程序池标识更改为“LocalSystem”,并将Load User profile设置为-True,但这并没有解决问题 堆栈跟踪: [Is
[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
对他很严厉。黑暗中的总镜头:你确定应用程序对系统硬盘有写访问权限吗?是的,只有当有大量记录时才会失败。可能是你在prod服务器上更快地耗尽了ram:我通过升级EPPlus库解决了这个问题。有同样的问题,并重新启动了IIS(不仅仅是AppPool)为我解决了。难对付。黑暗中的总镜头:你确定应用程序对系统硬盘有写访问权限吗?是的,只有当有大量记录时才会失败。可能是你在prod服务器上更快地耗尽了ram:我通过升级EPPlus库解决了这个问题。我也遇到了同样的问题,然后休息了一会IIS艺术(不仅仅是应用程序池)为我解决了这个问题。