2011-10-10 46 views
8

Tôi đang sử dụng thư viện EPPlus 2.8.0.2 trong ứng dụng ASP.NET MVC 3 của mình để tạo tệp excel. Ứng dụng này chạy trên IIS 6 trên Windows Server 2003 R2.Khởi tạo thất bại trên IsolatedStorage

Dòng vi phạm là thế này:

xlsdoc.GetAsByteArray 

xlsdoc là một đối tượng ExcelPackage nạp đúng cách.

Tạo đầu ra nhỏ là tốt, nhưng việc tạo ra sản lượng lớn tạo ra một lỗi:

System.IO.IsolatedStorage.IsolatedStorageException: Initialization failed. 
    at System.IO.IsolatedStorage.IsolatedStorageFile.Init(IsolatedStorageScope scope) 
    at System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType) 
    at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder.GetCurrentStore() 
    at MS.Internal.IO.Packaging.PackagingUtilities.ReliableIsolatedStorageFileFolder..ctor() 
    at MS.Internal.IO.Packaging.PackagingUtilities.GetDefaultIsolatedStorageFile() 
    at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName) 
    at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() 
    at MS.Internal.IO.Packaging.SparseMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count) 
    at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) 
    at System.IO.StreamWriter.Write(String value) 
    at System.IO.TextWriter.Write(String format, Object arg0) 
    at OfficeOpenXml.ExcelWorksheet.UpdateRowCellData(StreamWriter sw) 
    at OfficeOpenXml.ExcelWorksheet.SaveXml() 
    at OfficeOpenXml.ExcelWorksheet.Save() 
    at OfficeOpenXml.ExcelWorkbook.Save() 
    at OfficeOpenXml.ExcelPackage.GetAsByteArray(Boolean save) 
    at OfficeOpenXml.ExcelPackage.GetAsByteArray() 
    at ReportCenterLib.ReportGenerator.GenerateStream(DataTable result, String reporttitle, String inputparmstr, String conndescs, String username, String outputtype, String templatefile) in D:\PROJECTS\reportcentermvc\sources\ReportCenterLib\ReportGenerator.vb:line 450 
    at ReportCenterMVC.ReportCenterMVC.ReportController.Generate(Int64 id, IList`1 conns, IDictionary`2 parms, String outputtype) in D:\PROJECTS\reportcentermvc\sources\ReportCenterMVC\Controllers\ReportController.vb:line 218 

tôi nghi ngờ EPPlus cố gắng để tạo ra các file tạm thời sử dụng IsolatedStorage, nhưng không có quyền ghi vào IsolatedStorage. Tôi đã thay đổi nhận dạng hồ bơi ứng dụng thành 'hệ thống cục bộ' và lỗi biến mất.

Làm cách nào để tránh lỗi này khi sử dụng nhận dạng 'dịch vụ mạng'?

+0

Sự cố liên quan và thông tin thêm cho bất kỳ ai khác tìm thấy điều này: http://epplus.codeplex.com/workitem/14762 – richardtallent

Trả lời

8

Ai đó blogged about this. Các lỗi anh ấy (access denied) là khác nhau từ các lỗi mà tôi có, nhưng giải pháp của ông đã làm việc cho tôi:

  • Tạo một thư mục trên máy chủ tại C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage
  • Hãy cho ghi vào tất cả mọi người đến thư mục đó
+1

liên kết đã chết vào năm 2014-08-05 – JerryOL

0

Thảo luận ở đây: http://openxmldeveloper.org/

chiết xuất:

create folder named IsolatedStorage at the following path "C:\Documents and Settings\Default User\Local Settings\Application Data" and give the permission for IIS_WPG to modify and write. This solves the problem on the windows server 2003

Các vấn đề liên quan