2011-10-10 17 views
8

私はASP.NET MVC 3アプリケーションでEPPlus 2.8.0.2ライブラリを使用してExcelファイルを生成しています。このアプリケーションは、Windows Server 2003 R2上のIIS 6上で動作します。IsolatedStorageで初期化に失敗しました

問題のある行はこれです:

xlsdoc.GetAsByteArray 

xlsdocが正しくロードされExcelPackageオブジェクトです。小さな出力を生成

は大丈夫ですが、大きな出力を生成すると、エラーが発生し:

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 

私はEPPlusがIsolatedStorageを使用して一時ファイルを作成しようとしますが、IsolatedStorageへの書き込み権限を持っていなかった疑いがあります。アプリケーションプールIDを「ローカルシステム」に変更したため、エラーが表示されなくなりました。

「ネットワークサービス」IDを使用しているときにこのエラーを回避するにはどうすればよいですか?

+0

関連する問題とこれを見つける他の人のための詳細情報: http://epplus.codeplex.com/workitem/14762 – richardtallent

答えて

8

誰かblogged about this。彼は(アクセス拒否)を得たエラーは、私が得たエラーは異なっていたが、彼のソリューションは、私の仕事:

  • C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage
  • でサーバー上のフォルダを作成し、そのフォルダ
  • に皆への書き込みアクセスを与えます
+1

link dead on 2014-08-05 – JerryOL

0

は、ここで議論 :http://openxmldeveloper.org/

エキス:

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

関連する問題