English 中文(简体)
web.config 中有多个 Crystal Reports 版本。
原标题:
  • 时间:2009-03-20 19:29:10
  •  标签:

Before we were not using Crystal Reports. In our project now we have added Crystal Reports to our project. When I transferred my project to the server it produced a Crystal error. I suspect that Crystal is not installed on the server. Then installed Crystal 11 on the server. The development machines have Crystal 8.5. The server produces this error at the application startup.

无法加载文件或程序集CrystalDecisions.ReportAppServer.ClientDoc,Version=10.2.3600.0,Culture=neutral,PublicKeyToken=692fbea5521e1304或其依赖项之一。系统找不到指定的文件。

  • Is it possible to have two version reference in web.config? (i.e. crystal 8.5 & 11)

  • 这个问题该怎么解决?

在开发环境中使用C#,Visual Studio 2005和Crystal Reports 8.5。

问题回答

Best solution is installing same runtime on the server.
Anyway, you can use this XML in your app.config or web.config:

  <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304" culture="neutral"/>
        <bindingRedirect oldVersion="xx.x.xxxx.x" newVersion="yy.y.yyyy.y"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304" culture="neutral"/>
        <bindingRedirect oldVersion="xx.x.xxxx.x" newVersion="yy.y.yyyy.y"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="CrystalDecisions.ReportSource" publicKeyToken="692fbea5521e1304" culture="neutral"/>
        <bindingRedirect oldVersion="xx.x.xxxx.x" newVersion="yy.y.yyyy.y"/>
      </dependentAssembly>
      <dependentAssembly>
        ...
    </assemblyBinding>
  </runtime>

其中oldVersion是您用于开发的版本,newVersion是安装在服务器上的版本。

您可能需要在项目中添加对该DLL的引用(或以其他方式将其放入您的/ bin文件夹中)。

错误消息已经说得很清楚了,您的服务器是否有版本为10.2.3600.0的CrystalDecisions.ReportAppServer.ClientDoc以及匹配的令牌,无论是在GAC还是在应用程序或网站可以找到的地方?

听起来你需要在服务器上进行配置更新。

这只是版本冲突,因为您的开发机器正在使用较早版本,当您尝试在服务器上运行时,它正在寻找那个版本的.DLL文件。您最好确保在开发机器和服务器上安装了相同的版本,然后确保您的web.config在两者中都使用Crystal 11的DLL文件。

现在的快速方法是找出服务器上的正确文件版本,并将该数字输入到web.config中。

编辑:另一个选择是在服务器上更改 web.config 中的 .DLL 版本,与其他人所说的基本相同。问题在于每次部署时都必须不断更改它... 这将非常让人恼火。此外,你在开发设备上的测试并不真正有效,因为你正在测试一个不同的程序。由于版本之间有所改变,你几乎可以保证在生产中看到你从未在 DEV 中看到的漏洞。

您的开发PC有没有无法安装水晶11的原因?

不,引用同名程序集的两个不同版本是不可能的。

使此工作的一种方法是拥有两个不同的web.config文件。一个用于开发,另一个用于生产。作为部署的一部分,只需使用prod版本的文件。如果您的部署是自动化的,这应该很简单,只需在文件复制完成后删除开发中的web.config并将生产版本重命名即可。

10.2.3600.0是与最新补丁一起包含在Visual Studio 2005中的Crystal Reports版本。

您需要在服务器上安装 .net 2.0 的Crystal Reports运行时。您可以从开发机获取运行时安装程序。

x64 C:Program Files (x86)Microsoft Visual Studio 8Crystal ReportsCRRedistX64

x86 C:Program Files (x86)Microsoft Visual Studio 8SDKv2.0BootStrapperPackagesCrystalReports





相关问题
热门标签