Crystal Reports on Windows Server 2012 class not registered error

0

This question has been asked before:

Crystal Report in .NET Framework 4.0

and

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154

But I am (I think, running into a slightly different problem, or at least I hope so).

I have a Solution in Visual Studio 2017 that contains projects for 16 separate websites. So, config changes like switching from "Any CPU" to "x86" are not trivial. I made one stab at doing this and failed so miserably that I completely broke the site I am trying to fix!

In my attempts to understand the problem I have built the site on my dev box (Windows 10, 64bit) and run it under localhost and everything works. In particular, the call to New ReportDocument() works and I get the expected PDF of a Crystal Report.

However, when I deploy the project to my dev server running Windows Server 2012 the same attempt to view a generated PDF file fails.

When I use a Try-Catch around the offending call to 'New ReportDocument(), theexception` is:

 $exception {"The type initializer for
 'CrystalDecisions.CrystalReports.Engine.ReportDocument'
     threw an exception."}  System.TypeInitializationException

And the InnerException is:

InnerException {"Retrieving the COM class factory for component with CLSID
 {4DB2E2BB-78E6-4AEA-BEFB-FDAAB610FD1B} failed due to the following error:
 80040154 Class not registered (Exception from HRESULT: 0x80040154
 (REGDB_E_CLASSNOTREG))."}  System.Exception {System.Runtime.InteropServices.COMException}

I also found a link to: regasm and generated .reg files on my machine to then load on my dev server, but this had no effect on my error.

Finally, please note that this is likely a product of upgrading from the Crystal Reports that is compatible with Visual Studio 2015 to the one for Visual Studio 2017. I now truly regret making that change but I am not sure if it can be undone safely.

What am I missing in moving my project from my dev machine to my dev server?


Update

I still have not found a solution...

I did find this post in forums.iis.net. I am working through it's hints but have not finished and thought I would update my question here in case it helps someone else.

Still looking for some suggestions.

c#
.net
crystal-reports
visual-studio-2017
asked on Stack Overflow Jan 3, 2018 by cptully • edited Jan 6, 2018 by cptully

1 Answer

0

So, it turns out, after paying SAP $195 for a single case support ticket, that the solution was multi-factored but almost too obvious!

  1. Not all of my servers had the correct version of the CRruntime installed so I had to uninstall an old version and install the current version on one server.
  2. There were at least two different web.config files that were still referencing the old version of the CRruntime DLLs. Once I manually updated those things started working.
  3. I found that I had to be careful of my order of operations. The web.config files do not seem to be published with the rest of my site when I tell Visual Studio 2017 to publish the site. So, in one instance I copied a good web.config file then published the site. CR was still causing issues so I copied a known good web.config on to the server again and the site started working.

All in all it was a case of version incompatibility!

answered on Stack Overflow Jan 10, 2018 by cptully

User contributions licensed under CC BY-SA 3.0