一个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 Settings\Default 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_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-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

Unable to create the store directory. (Exception from HRESULT: 0x80131468)的更多相关文章

  1. jenkins网页报错,Unable to create the home directory ‘/usr/share/tomcat7/.jenkins’. This is most likely a permission problem

    cd /usr/share/tomcat7 sudo mkdir .jenkins sudo chown tomcat7:nogroup .jenkins 执行以上操作,重启解决

  2. 线程ava.lang.OutOfMemoryError: unable to create new native thread

    近日开发遇到多线程的问题: java.lang.OutOfMemoryError: unable to create new native thread Exception in thread &qu ...

  3. HTTP Status 500 - Unable to create directory

    分析原因: 例如:java web项目 上传图片创建文件夹cd /data/apps/static-web/sjk/driver/attachment/编号/文件名称.jpg 在创建文件目录 /dat ...

  4. 使用Docker Compose 部署Nexus后提示:Unable to create directory /nexus-data/instance

    场景 Ubuntu Server 上使用Docker Compose 部署Nexus(图文教程): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/ ...

  5. EXCEPTION:FATAL: UNABLE TO CREATE ‘…GIT/INDEX.LOCK’ FILE EXISTS

    FATAL: UNABLE TO CREATE ‘…GIT/INDEX.LOCK’ FILE EXISTS Hi, Today I will share you my other experience ...

  6. 记一次tomcat线程创建异常调优:unable to create new native thread

    测试在进行一次性能测试的时候发现并发300个请求时出现了下面的异常: HTTP Status 500 - Handler processing failed; nested exception is ...

  7. sqlplus链接数据库报ORA-09925: Unable to create audit trail file

    [localhost.localdomain]:[/oracle11/app/oracle11/product/11.2.0/dbhome_1/dbs]$ sqlplus / as sysdba SQ ...

  8. java.lang.OutOfMemoryError: unable to create new native thread如何解决

    工作中碰到过这个问题好几次了,觉得有必要总结一下,所以有了这篇文章,这篇文章分为三个部分:认识问题.分析问题.解决问题. 一.认识问题: 首先我们通过下面这个 测试程序 来认识这个问题:运行的环境 ( ...

  9. Java使用JAX-WS来写webservice时 Unable to create JAXBContext

    webservice,作为web开发人员来说必须掌握的一门技术,它的好处这里就不多说了,eclipse中自带了一种生成webservice的 方法,使用JAX-WS,如果我没有弄错的话,它需要java ...

随机推荐

  1. CentOS里下载百度网盘 / 360 网盘资源的方法

    wget -c --referer=引用地址 -O 文件名 "真实下载地址" 例如,我下载资源原在的页面为http://pan.baidu.com/s/1cfJXZ ,实际下载地址 ...

  2. 转:怎么使用github(通俗易懂版)

    转:  https://www.zhihu.com/question/20070065 作者:珊姗是个小太阳链接:https://www.zhihu.com/question/20070065/ans ...

  3. 第一章 响应式设计之Media Quer

    书里谈到尽量不要使用Media Queriy. 但是过多使用media query,会导致CSS变得脆弱和页面难以维护.一些方法可以减少页面使用 media query. 响应式设计: (1) 使用百 ...

  4. 【ERROR】---Error executing "adb devices":ADB server didn't ACK

    搭建环境     ionic emulate android 的时候出现问题 端口占用,找到占用端口的程序,结束进程再启动 重新ionic emulate android 还是报错,闪了一下说fail ...

  5. 【转】C# 中访问修饰符

    用通过代码:  类内部 using System;class Mod{    void defaultMethod()    {        Console.WriteLine("this ...

  6. openquery链表删除时报错 “数据提供程序或其他服务返回 E_FAIL 状态”

    DELETE OPENQUERY (VERYEAST_COMPANY_MYSQL_CONN, 'SELECT * FROM company ') WHERE c_userid in(select c_ ...

  7. Iframe跨域_ASP.NET

    1.描述: A系统 需要 调用 B系统的页面,被调用的B系统的页面b.html内部嵌套了iframe框架c.aspx地址页 2.问题呈现: ie浏览器下 Chrome浏览器下 追踪 3.问题原因: X ...

  8. 20150309--gridview

    GridView: 使用代码套用模板,变为DataList的样式,添加<asp:TemplateField>标签,(注意必须加上<Columns>) <asp:GridV ...

  9. Tomcat 优化 java.lang.OutOfMemoryError: Java heap space 的解决方法

    Tomcat 优化 java.lang.OutOfMemoryError: Java heap space 的解决方法 java.lang.OutOfMemoryError: Java heap sp ...

  10. CSS Sprite 雪碧图制作

    CSS Sprite 雪碧图,简单来说就是: 为了提高网页的性能,减少加载次数,将一些不会经常随网站内容变化的小图标,集中放在一张大图上,将该图应作为background-image 嵌入页面中,在需 ...