2011-10-10 14 views
8

Utilizzo la libreria EPPlus 2.8.0.2 nell'app ASP.NET MVC 3 per generare file excel. Questa applicazione funziona su IIS 6 su Windows Server 2003 R2.Inizializzazione non riuscita su IsolatedStorage

La riga all'origine è questo:

xlsdoc.GetAsByteArray 

xlsdoc è un oggetto ExcelPackage correttamente caricato.

Generazione piccola uscita va bene, ma che genera grande uscita produce un errore:

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 

ho il sospetto EPPlus tenta di creare file temporanei utilizzando IsolatedStorage, ma non ha avuto il permesso di scrivere IsolatedStorage. Ho cambiato l'identità del pool di applicazioni in "sistema locale" e l'errore scompare.

Come evitare questo errore durante l'utilizzo dell'identità 'servizio di rete'?

+0

Problema correlato e ulteriori informazioni per chiunque altro che trova questo: http://epplus.codeplex.com/workitem/14762 – richardtallent

risposta

8

Qualcuno blogged about this. L'errore ha ottenuto (accesso negato) era diverso da l'errore che ho ottenuto, ma la sua soluzione ha funzionato per me:

  • Creare una cartella sul server al C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage
  • consentire l'accesso in scrittura a tutti di quella cartella
+1

link dead on 2014-08-05 – JerryOL

0

Discussi qui: http://openxmldeveloper.org/

estratto:

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

Problemi correlati