8

ASP.NET MVC 3 アプリで EPPlus 2.8.0.2 ライブラリを使用して Excel ファイルを生成しています。このアプリケーションは、Windows Server 2003 R2 上の IIS 6 で実行されます。

問題のある行は次のとおりです。

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 の使用中にこのエラーを回避するにはどうすればよいですか?

4

2 に答える 2

8

誰かがこれについてブログを書きました。彼が受け取ったエラー (アクセスが拒否されました) は、私が受け取ったエラーとは異なりましたが、彼の解決策はうまくいきました。

  • サーバー上にフォルダーを作成します。C:\Documents and Settings\Default User\Local Settings\Application Data\IsolatedStorage
  • そのフォルダへの書き込みアクセス権を全員に付与します
于 2011-10-11T02:56:26.917 に答える
0

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

エキス:

次のパス「C:\Documents and Settings\Default User\Local Settings\Application Data」に IsolatedStorage という名前のフォルダーを作成し、IIS_WPG に変更と書き込みのアクセス許可を与えます。これにより、Windows Server 2003 の問題が解決されます。

于 2014-08-05T21:35:30.970 に答える