Error when running Crystal Report: "The type initializer for 'CrystalDescisions.CrystalReports.Engine.ReportDocument' threw an exception"

When getting error Crystal Report: "The type initializer for 'CrystalDescisions.CrystalReports.Engine.ReportDocument' threw an exception", check the following:

  1. Your application should be compiled on x66 or AnyCPU
  2. Crystal report x64 & x86 versions should be installed on the server
  3. Make sure crystalreportviewersXX (example: crystalreportviewers13) folder is present in website root folder
  4. Make sure aspnet_client folder is present in website root folder
  5. Make sure website's App Pool is configured to run 32Bit applications
  6. The final step is to look into your web.config and remove any forced bindings. A forced binding shall appear in  <assemblyBinding> section or <compilation> section and looks like following.

<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

This should resolve the Crystal Report error.

Was this answer helpful? 2 Users Found This Useful (2 Votes)