Unable to cast COM object of type 'CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass'
Asked Answered
A

5

16

I have 2 windows program.

Program A : create with visual studio 2015 with crystal report SP18

Program B : create with visual studio 2017 with crystal report SP22

I have a computer with crystal report runtime SP 18.

I run program A in that computer. Program A can create report. I run program B in that computer. Program B cannot create report. So, i upgrade the crystal report runtime to SP22. The result is Program B can create report.

Now the problem is Program A cannot create report after the upgrade. The error is :

System.InvalidCastException: Unable to cast COM object of type 'CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass' to interface type 'CrystalDecisions.ReportAppServer.Controllers.ISCRReportSource'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{98CDE168-C1BF-4179-BE4C-F2CFA7CB8398}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Refresh()
   at CrystalDecisions.ReportSource.EromReportSourceBase.Refresh(RequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Refresh(RequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Refresh()
   at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)
   at Portal_Inkaso.frIndex.PerintahCetakTT()
   at Portal_Inkaso.frIndex.Perintah1()
   at Portal_Inkaso.frIndex.llbPerintah_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
   at System.Windows.Forms.LinkLabel.OnLinkClicked(LinkLabelLinkClickedEventArgs e)
   at System.Windows.Forms.LinkLabel.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Label.WndProc(Message& m)
   at System.Windows.Forms.LinkLabel.WndProc(Message& msg)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

What should i do ? Downgrade crystall report runtime or what ?

Amero answered 6/3, 2018 at 4:25 Comment(0)
A
36

After googling a long time, i found the solution.

The solution is add below code in app.config/web.config

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportSource" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>    
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.Web" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.Windows.Forms" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.ClientDoc" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonControls" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonObjectModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.Controllers" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.CubeDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataSetConversion" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>    
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.ObjectFactory" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.Prompting" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.ReportDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.XmlSerialize" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
  </assemblyBinding>  
</runtime>

This is the source Crystal Reports, Developer for Visual Studio Downloads

Solution

Amero answered 4/5, 2018 at 14:50 Comment(3)
you save my lifeCruzeiro
In my case, I made oldVersion="13.0.2000.0" and newVersion="13.0.2000.0" same. And it worked !!Jerroldjerroll
Is there any way to develop with upper version and deploy in lower version! That is oldVersion="13.0.4000.0" newVersion="13.0.2000.0" May be my life will be safe!Feldspar
A
0

Just remove old reference of crystal reports and add new assemblies. this is due to crystal report version difference old compilation working with old versions.

Simply add new reference assembly of current version and clean solution and rebuild the project and run.

It works.

Alpert answered 4/10, 2019 at 13:55 Comment(0)
A
-1

I use win 10 64 bit.

App Server use 64 bit OS.

For this issue, I can give you advices :

  1. IIS App Pool : Enabled 32 Bit App
  2. At my case, another team use CR Runtime SP 20. And my app use CR Runtime SP 21. My computer is 64 bit OS but I Install CR Runtime SP 21 32 bit version, and then this case solved (I must uninstall first CR Runtime SP 20 before Install CR Runtime SP21)

Case solved and we should upgrade older version of CR to newer version (SP 21 at my case) or vice versa.

Maybe Your currnt CR Runtime is SP 21 or above . Try to downgrade to CR SP 20 or below.

Arevalo answered 5/1, 2021 at 16:55 Comment(0)
P
-1

https://support.itserver.biz/to-run-crystal-report-on-windows-iis-server/

  • first download and install the runtime like CRVS2010CR3220_0-10010309 create
  • c:\temp folder
  • give read / write permission to c:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\
  • enable 32 bit application in iis application pool
  • copy crystal report assembly files from c:\Windows\assembly\GAC_MSIL
    to application bin folder
  • remove crystal report version number from web.config and .aspx where crystal report viewer control is used to avoid version conflict
Pneumothorax answered 23/8, 2023 at 16:38 Comment(0)
D
-1

Just to share my fix to everyone. Although the installer/uninstaller doesn't prompt you for restarting your computer, you really should restart your computer after installing/reinstalling CR runtime. If you're doing web dev, make sure you turn off iis before installing/uninstalling CR runtime.

Demarcation answered 31/10, 2023 at 2:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.