runliuv

runliuv@cnblogs

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

未能加载文件或程序集“Newtonsoft.Json”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

 

原因:

packages.config 中的 Newtonsoft.Json 版本与 Web.config 中的 Newtonsoft.Json 版本不一致导致的。

packages.config中的版本是 6.0 :

<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net46" />

Web.config 中的版本(newVersion)是:13.0

<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />

解决方法:

Web.config 中的版本(newVersion)改为:6.0 ,与 packages.config 保持一致:

<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>

 

--

posted on 2025-01-10 10:46  runliuv  阅读(204)  评论(0)    收藏  举报