zoukankan      html  css  js  c++  java
  • 关于NewJson dll 引用不一致

    {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”
       在 Qiniu.Util.QiniuJsonHelper.JsonEncode(Object obj)
       在 Qiniu.RS.PutPolicy.ToString()
       在 Qiniu.RS.PutPolicy.Token(Mac mac)
       在 Common.Qiniufun.PutFile(String bucket, String key, String fname) 位置 e:项目AccountingAccountingCommonQiniufun.cs:行号 236
       在 Accounting.Controllers.ConsoleController.UploadImage() 位置 e:项目AccountingAccountingAccountingControllersConsoleController.cs:行号 240
    
    === 预绑定状态信息 ===
    日志: DisplayName = Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
     (Fully-specified)
    日志: Appbase = file:///E:/项目/Accounting/Accounting/Accounting/
    日志: 初始 PrivatePath = E:项目AccountingAccountingAccountingin
    调用程序集: System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35。
    ===
    日志: 此绑定从 default 加载上下文开始。
    日志: 正在使用应用程序配置文件: E:项目AccountingAccountingAccountingweb.config
    日志: 使用主机配置文件: C:UsersAdministratorDocumentsIISExpressconfigaspnet.config
    日志: 使用 C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.config 的计算机配置文件。
    日志: 策略后引用: Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
    日志: 尝试下载新的 URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/8886c122/ebad9a1/Newtonsoft.Json.DLL。
    日志: 尝试下载新的 URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/8886c122/ebad9a1/Newtonsoft.Json/Newtonsoft.Json.DLL。
    日志: 尝试下载新的 URL file:///E:/项目/Accounting/Accounting/Accounting/bin/Newtonsoft.Json.DLL。
    警告: 比较程序集名称时发生不匹配: 主版本
    错误: 未能完成程序集的安装(hr = 0x80131040)。探测终止。
    }

    确认dll文件和版本之后在webconfig添加以下代码

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    

      newVersion为版本信息

  • 相关阅读:
    iOS
    UIView
    sql server 无法创建索引 因为对象名称和索引名称重复
    select2多选
    NPOI 给导出Excel添加简单样式
    NPOI简单的给某个单元格字体设置颜色
    ASP.NET MVC5 历史数据查询
    C# 反射Reflection
    C# 程序集Assembly
    GetExecutingAssembly() 和 GetCallingAssembly() 的区别
  • 原文地址:https://www.cnblogs.com/chongyao/p/6830516.html
Copyright © 2011-2022 走看看