Itextsharp dll版本错误

时间:2016-09-10 06:45:23

标签: asp.net-mvc-4 dll itext

我在我的应用程序中使用itextsharp生成pdf并且它工作正常。但在过去几天我收到以下错误

 "Could not load file or assembly 'itextsharp, Version=5.5.9.0,  
  Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its
  dependencies. The located assembly's manifest definition does not match
  the assembly reference. (Exception from HRESULT: 0x80131040)"

我检查了bin文件夹中的dll并且确定dll版本是5.5.8.0并且webconfig看起来像这样

 <dependentAssembly>
    <assemblyIdentity name="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.5.8.0" newVersion="5.5.8.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="itextsharp.xmlworker" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.5.8.0" newVersion="5.5.8.0" />
  </dependentAssembly>

它是托管相关问题还是我们方面的问题?

1 个答案:

答案 0 :(得分:0)

似乎正在更新dll引用,但不是web.config。尝试将您的web.config更新为版本5.5.9.0,如下所示。

<dependentAssembly>
    <assemblyIdentity name="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.5.8.0" newVersion="5.5.9.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="itextsharp.xmlworker" publicKeyToken="8354ae6d2174ddca" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.5.8.0" newVersion="5.5.9.0" />
  </dependentAssembly>