2011-10-10 8 views
8

Estoy utilizando la biblioteca EPPlus 2.8.0.2 en mi aplicación ASP.NET MVC 3 para generar archivos de Excel. Esta aplicación se ejecuta en IIS 6 en Windows Server 2003 R2.Falló la inicialización en IsolatedStorage

La línea en cuestión es la siguiente:

xlsdoc.GetAsByteArray 

xlsdoc es un objeto ExcelPackage correctamente cargado.

Generación pequeña salida está muy bien, pero la generación de salida grande produce un error:

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 

sospecho EPPlus intenta crear archivos temporales utilizando IsolatedStorage, pero no tienen permiso para escribir en IsolatedStorage. Cambié la identidad del grupo de aplicaciones a 'sistema local' y el error desaparece.

¿Cómo puedo evitar este error al usar la identidad del 'servicio de red'?

+0

Problema relacionado y más información para cualquier otra persona que encuentre esto: http://epplus.codeplex.com/workitem/14762 – richardtallent

Respuesta

8

Alguien blogged about this. El error se puso (acceso denegado) era diferente del error que me dieron, pero su solución funcionó para mí:

  • crear una carpeta en el servidor en C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage
  • dar acceso de escritura a todo el mundo a esa carpeta
+1

link dead on 2014-08-05 – JerryOL

0

discutido aquí: http://openxmldeveloper.org/

extracto:

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

Cuestiones relacionadas