ReportDocument 构造函数抛出的 TypeInitializerException [英] TypeInitializerException thrown by ReportDocument constructor

查看:28
本文介绍了ReportDocument 构造函数抛出的 TypeInitializerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ASP .NET Web 应用程序,它引用了来自 32 位 Crystal Reports 运行时的程序集.(从 CRRedist2008_x86.msi 安装)部署它的服务器具有 64 位 Crystal Reports 运行时.包含 CrystalReportViewer 的表单抛出以下异常:

I have an ASP .NET web application which has references to assemblies from the 32-bit Crystal Reports runtime. (Installed from CRRedist2008_x86.msi) The server on which it has been deployed has a 64-bit Crystal Reports runtime. The form containing the CrystalReportViewer throws the following exception:

System.TypeInitializationException:类型初始值设定项'CrystalDecisions.CrystalReports.Engine.ReportDocument' 抛出一个例外.---> System.UnauthorizedAccessException: 检索 COM具有 CLSID 的组件的类工厂{5FF57840-5172-4482-9CA3-541C7878AE0F}由于以下原因失败错误:80070005.在CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor() --- 结束内部异常堆栈跟踪 --- 在CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor() 在[qualifiedFormName]_Load(Object sender, EventArgs e)

System.TypeInitializationException: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. ---> System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error: 80070005. at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor() --- End of inner exception stack trace --- at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor() at [qualifiedFormName]_Load(Object sender, EventArgs e)

虽然我意识到使开发环境与运行时环境相同是理想的解决方案,但我希望有一些方法可以解决这个问题,而无需升级开发环境.

While I realize that making the dev environment identical to the runtime environment would the ideal solution, I was hoping there were some way to resolve this without having to upgrade the development environment.

在服务器上的 web.config 中更新对 Crystal Reports 程序集的引用是否有效?

Would updating the references to Crystal Reports assemblies in web.config on the server work?

推荐答案

  • 打开 Windows 注册表 (Regedit.exe)
  • 搜索 5FF57840-5172-4482-9CA3-541C7878AE0F
  • 您应该找到一个密钥,将其展开并转到每个子节点,直到找到安装路径.
  • 转到那个路径(通常是 C:Program ...Business Objects...in...)
  • 授予 ASP .NET、IIS 工作进程、匿名 Web 用户进程帐户的完全权限

    • Open windows registry (Regedit.exe)
    • Search for 5FF57840-5172-4482-9CA3-541C7878AE0F
    • You should find a key, expand it and go to each child nodes until you find the installation path.
    • Go to that path (usually C:Program ...Business Objects...in...)
    • Grant full permission for ASP .NET, IIS worker process, Anonymous Web User process accounts

      你应该没事了.

      这篇关于ReportDocument 构造函数抛出的 TypeInitializerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆