zoukankan      html  css  js  c++  java
  • Unable to create the store directory. (Exception from HRESULT: 0x80131468)

      一个ASP.NET的程序,使用了MS ReportViewer报告控件,在用该控件导出生成Excel文件时,先是提示行不能超过65535。 这个是由于Excel2003的行限制的原因。由于修改成用Excel2007格式导出,用这种方法导出时报了如下错误:

    Unable to create the store directory. (Exception from HRESULT: 0x80131468) 
    错误堆栈: at System.IO.IsolatedStorage.IsolatedStorageFile.GetRootDir(IsolatedStorageScope scope, StringHandleOnStack retRootDir) at System.IO.IsolatedStorage.IsolatedStorageFile.InitGlobalsNonRoamingUser(IsolatedStorageScope scope) at System.IO.IsolatedStorage.IsolatedStorageFile.GetGlobalFileIOPerm(IsolatedStorageScope scope) 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.GetDefaultIsolatedStorageFile() at MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String
    & fileName) at MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream() at MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() at MS.Internal.IO.Zip.ZipIOFileItemStream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.IO.Compression.DeflateStream.InternalWrite(Byte[] array, Int32 offset, Int32 count, Boolean isAsync) at System.IO.Compression.DeflateStream.Write(Byte[] array, 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 Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.XMLModel.XMLStreamsheetModel.WriteStreamToStream(Stream from, Stream to) at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.XMLModel.XMLStreamsheetModel.Cleanup() at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.OpenXmlGenerator.FinalizeWorksheet() at Microsoft.ReportingServices.Rendering.ExcelOpenXmlRenderer.OpenXmlGenerator.SaveSpreadsheet(Stream outputStream, Stream backgroundImage, UInt16 backgroundImageWidth, UInt16 backgroundImageHeight) at Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)

      搜索了个原因,说是当导出的文件比较大时(>10M)时,会使用IsolatedStore来保存临时生成的文件,但当前运行ASP.NET的站点用户(Network Service, win2003)没有像Administrator或其它自己新建的账户那样生成本地用户档案,类似于‘C:Documents and SettingsDefault User’这样的文件夹,又没有足够的权限来创建。所以就报了‘Unable to create the store directory’的错误。

      解决方法:

      1. 使用ASP.NET的用户模拟。在Web.Config中使用类似如下的配置实现模块:    

    <configuration>
    <system.web>
    <identity impersonate="true" userName="accountname" password="password" />
    </system.web>
    </configuration>

        关于模拟的信息可考虑:http://support.microsoft.com/kb/306158/zh-cnhttp://msdn.microsoft.com/en-us/library/xh507fc5.ASPX

      2. 修改注册表: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileListS-1-5-20 把 S-1-5-20重命名为其它名称。

        该方法只适用于Win2003,如果修改win7的系统,会导致windows激活失效。

      参考:

      http://www.kevinrohrbaugh.com/blog/tag/openxml

      http://stackoverflow.com/questions/6679193/openxml-isolatedstorage-network-service-and-windows-server-2008

      http://stackoverflow.com/questions/3242102/a-cause-for-hresult-0x80131468-when-accessing-isolatedstoragebackingstore

  • 相关阅读:
    《我是一只IT小小鸟》
    &&、||、?:、,四个运算符的求值顺序
    C Traps and Pitfalls 练习4.2
    “检测到LoaderLock”的解决办法
    VS中代码对齐等快捷键
    贪心 Greedy Algorithms
    这些最基本的程序优化方法你用过吗?
    内存区划分、内存分配、常量存储区、堆、栈、自由存储区、全局区[C++][内存管理][转载]
    [原创]让对话框的控件支持tooltips
    Debug 运行正常但 Release 失败的问题,Debug 和 Release 编译方式的本质区别
  • 原文地址:https://www.cnblogs.com/jmax/p/3488597.html
Copyright © 2011-2022 走看看