zoukankan      html  css  js  c++  java
  • Newtonsoft.Json文件错误

    今天,在一个项目中使用signalR,由于项目框架是.net 4.0,所以用signalR1.0版本,signalR使用需要newtonsoft.Json文件,它把原  newtonsoft.Json文件覆盖了,所以程序运行时出现如下错误:

      “  未能加载文件或程序集“Newtonsoft.Json”或它的某一个依赖项。无法验证强名称签名。此程序集可能已被篡改,或者已被延迟签名,但没有用正确的私钥进行完全签名。 (异常来自 HRESULT:0x80131045) ”

    为了以防多方使用newtonsoft.json文件出现不同的版本冲突,所以该项目里对其做了处理,在web.config里,加入如下条件:

    <runtime>
                <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                    <dependentAssembly>
                        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
                        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
                    </dependentAssembly>
                    <dependentAssembly>
                        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
                        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
                    </dependentAssembly>
                    <dependentAssembly>
                        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
                        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
                    </dependentAssembly>
                    <dependentAssembly>
                        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
                        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
                    </dependentAssembly>
    
                    <dependentAssembly>
                        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                        <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
                    </dependentAssembly>
                </assemblyBinding>
            </runtime>
    View Code

    <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
    </dependentAssembly>该节点表面自动将所有老版本绑定为6.0版本。

    所以将新加载的newtonsoft.json删掉,重新引用原6.0版本的。

    但由于之前已经进行了编译,所以运行后那个错误还存在,我的解决办法就是在系统盘里找到Temporary ASP.NET Files文件,删掉,重新编译就OK

  • 相关阅读:
    java.lang.OutOfMemoryError:GC overhead limit exceeded填坑心得
    linux修改系统时间和linux查看时区、修改时区的方法
    关于elasticsearch和kibana的时区和日期问题
    Jmeter中的几个重要测试指标释义
    jmeter之json数据参数化 断言等
    daemon
    linux之cp/scp命令+scp命令详解
    C语言中文件的读取和写入
    koa 项目实战(四)注册接口和调试工具(postman)
    koa 项目实战(三)创建测试接口和用户模型
  • 原文地址:https://www.cnblogs.com/beliee/p/3880526.html
Copyright © 2011-2022 走看看