You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

解决Newtonsoft.Json程序集清单定义与引用不匹配错误

Newtonsoft.Json版本冲突错误解决方案

错误信息

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

问题原因

这是Newtonsoft.Json库版本冲突导致的:Owin.*组件要求版本高于10.0.3,而Google.Apis.Core要求版本13.0.3,当前已安装的是Newtonsoft.Json 13.0.3版本,组件间版本依赖不匹配引发加载错误。

解决步骤

通过在web.config中配置绑定重定向(binding redirect),强制应用全局使用指定版本的Newtonsoft.Json:

  • 打开项目中的web.config文件
  • 在<configuration>节点内添加以下配置代码:
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-13.0.3.0" newVersion="13.0.3.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

该配置会将所有对0.0.0.0至13.0.3.0版本的Newtonsoft.Json请求,统一重定向到已安装的13.0.3版本。

添加配置后重新生成并运行应用,即可解决程序集版本冲突问题。


内容的提问来源于stack exchange,提问作者Nguyễn Tấn Dũng

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 21:22:02