到的程序集清单定义与程序集引⽤不匹配“/”应⽤程序中的服务器错误。
未能加载⽂件或程序集“Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某⼀个依赖项。到的程序集清单定义与程序集引⽤不匹配。 (异常来⾃ HRESULT:0x80131040)
说明: 执⾏当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.IO.FileLoadException: 未能加载⽂件或程序集“Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某⼀个依赖项。到的程序集清单定义与程序集引⽤不匹配。 (异常来⾃ HRESULT:0x80131040)
程序集加载跟踪: 下列信息有助于确定程序集“Newtonsoft.Json, Version=4.5.0.0, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed”未能加载的原因。
警告: 程序集绑定⽇志记录被关闭。
要启⽤程序集绑定失败⽇志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。
注意: 会有⼀些与程序集绑定失败⽇志记录关联的性能损失。
要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。
可是⼩猪不知道是啥时候引⽤了该死的这个4.5.0.0版本啊!!
这可折腾死⼩猪了!!不知道是何种原因,各种百度⾕歌,最后还是看到⽼外的⼀个解释:
It's not clear what the relationships of the projects are, or when this error is occuring, but here's a guess. You have 3 projects the facebook project (refs 4.0.0.0 version), twitter project (refs 4.0.3.0 version), and a main project that refs both of those projects. You may be able to build this solution, but when you run the assembly binding will fail. Why? because the default behavior is to copy assemblies locally before running. What happens is that the first project to build copies to bin (say twitter) then the second project builds (facebook), then main. However, at the end of this the 4.0.0.0 version is sitting bin folder. When you run, as soon as you invoke something from twitter that tries to use the problem assembly the bind fails because it longer has access to the 4.0.3.0 version of the assembly. There are a couple of ways around this. One is register both assemblies in the GAC. If that isn't doable then look into assembly binding redirection in your config file. Another is to register for theAssemblyResolve event and load the assembly programmatically.
然后⼩猪按照其⼤概的⽅法增加了这么⼀句:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
json检查</runtime>
OK了。这真是个蛋疼的下午!!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论