This question has been asked before:
Crystal Report in .NET Framework 4.0
and
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(), the
exception` 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?
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.
So, it turns out, after paying SAP $195 for a single case support ticket, that the solution was multi-factored but almost too obvious!
All in all it was a case of version incompatibility!
User contributions licensed under CC BY-SA 3.0