2011-10-10 4 views
8

J'utilise la bibliothèque EPPlus 2.8.0.2 dans mon application ASP.NET MVC 3 pour générer des fichiers Excel. Cette application s'exécute sur IIS 6 sur Windows Server 2003 R2.L'initialisation a échoué sur IsolatedStorage

La ligne incriminée est la suivante:

xlsdoc.GetAsByteArray 

xlsdoc est un objet ExcelPackage correctement chargé.

Génération petite sortie est bien, mais générer une sortie grand produit une erreur:

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 

Je soupçonne EPPlus essaie de créer des fichiers temporaires à l'aide IsolatedStorage, mais n'a pas eu la permission d'écrire à IsolatedStorage. J'ai changé l'identité du pool d'applications en 'système local', et l'erreur disparaît. Comment éviter cette erreur lorsque j'utilise une identité de «service réseau»?

+0

Problème lié et plus d'informations pour quelqu'un d'autre trouvant ceci: http://epplus.codeplex.com/workitem/14762 – richardtallent

Répondre

8

Quelqu'un blogged about this. L'erreur qu'il a (accès refusé) était différent de l'erreur que je suis arrivé, mais sa solution a fonctionné pour moi:

  • Créez un dossier sur le serveur à C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage
  • donnent accès en écriture à tout le monde dans ce dossier
+1

link dead le 2014-08-05 – JerryOL

0

évoquons ici: http://openxmldeveloper.org/

extrait:

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