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

后端 未结 3 840
后悔当初
后悔当初 2021-01-11 12:42

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

相关标签:
3条回答
  • 2021-01-11 12:52

    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.

    0 讨论(0)
  • 2021-01-11 12:56

    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

    0 讨论(0)
  • 2021-01-11 13:08

    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.

    0 讨论(0)
提交回复
热议问题