GVKun编程网logo

解决:未能加载文件或程序集“System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”...

1

本文将为您提供关于解决:未能加载文件或程序集“System.Web.Http,Version=5.2.4.0,Culture=neutral,PublicKeyToken=31bf3856ad364e

本文将为您提供关于解决:未能加载文件或程序集“System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”...的详细介绍,同时,我们还将为您提供关于'Abp.Zero.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' 方法 'Get' 没有实现、.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一、.net – 无法加载文件或程序集’System.Web.Abstractions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35′、20190620_二次开发 BarTender 打印机时,未能解析主引用 “Seagull.BarTender.Print, Version=1.0.0.0, Culture=neutral, pro...的实用信息。

本文目录一览:

解决:未能加载文件或程序集“System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”...

解决:未能加载文件或程序集“System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”...

今天发布web API,调用接口报错了:未能加载文件或程序集“System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

代码没问题,找了一会,发现是Web.Config的问题。runtime缺少dependentAssembly。加上就好了~
<dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
      </dependentAssembly>


复盘:
  1. 发布没有更新Web.Config,报错需要比对一下Web.Config。
  2. 如果返回内部错误,可以加上<customErrors mode="Off"/>,查看具体的错误信息。
<system.web>
    <customErrors mode="Off"/>
  </system.web>

 

'Abp.Zero.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' 方法 'Get' 没有实现

'Abp.Zero.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' 方法 'Get' 没有实现

如何解决''Abp.Zero.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'' 方法 ''Get'' 没有实现

  1. System.TypeLoadException:"Method ''Get''
  2. in type ''Abp.DynamicEntityProperties.DynamicEntityPropertyValueStore''
  3. from assembly ''Abp.Zero.Common,Version=6.0.0.0,Culture=neutral,PublicKeyToken=null''
  4. does not have an implementation."

我使用的是最新版本 6.0.0 AspNetCore-MVC-template。

问题是由“Abp.Zero.Common”引起的吗?

我该如何处理?

解决方法

这可能是由于从“Abp”版本 6.0.0 到 6.2.0 过渡期间的依赖冲突导致的。在没有升级的情况下使用6.0.0版本的过程中,“Abp.AutoMapper(6.0.0)”库依赖的“Abp”库自动变成了6.2.0版本。。我把“Abp”版本升级到6.2后.0,这个问题解决了。

.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一

.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一

这一个错误让我疯了.

我在我的一个名为BaseServices的类库中安装了SendGrid NuGet包,它依赖于Newtonsoft.Json v7.0.1,所以它将它安装在我的packages文件夹中并引用它.

在类库中,我有这个绑定重定向:

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

在ASP.NET MVC应用程序的web.config中,即使用我的类库的客户端应用程序,我有一个小于v6版本的程序集绑定重定向指向Newtonsoft.Json库的v6,如下所示:

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

当我运行我的电子邮件发送BaseServices库中的代码时,我收到此错误:

The thread 0x1a4c has exited with code 0 (0x0).
System.IO.FileLoadException: Could not load file or assembly
‘Newtonsoft.Json,Version=7.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) File name:
‘Newtonsoft.Json,
PublicKeyToken=30ad4fe6b2a6aeed’ at
SendGrid.Helpers.Mail.Mail.Get() at
BaseServices.EmailService.SendAsync(EmailMessage message) in
MyFolder\BaseServices\EmailService.cs:line 39

=== Pre-bind state information === LOG: displayName = Newtonsoft.Json,PublicKeyToken=30ad4fe6b2a6aeed
(Fully-specified) LOG: Appbase = file:///MyFolder/Web/ LOG: Initial
PrivatePath = MyFolder\Web\bin Calling assembly : SendGrid,
Version=7.0.3.0,PublicKeyToken=4f047e93159395ca.
=== LOG: This bind starts in default load context. LOG: Using application configuration file: MyFolder\Web\web.config LOG: Using
host configuration file:
C:\Users\computer\Documents\IISExpress\config\aspnet.config LOG: Using
machine configuration file from
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Newtonsoft.Json,
Culture=neutral,PublicKeyToken=30ad4fe6b2a6aeed LOG: Attempting
download of new URL
file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET
Files/root/ef9cacdf/e639667a/Newtonsoft.Json.DLL. LOG: Attempting
download of new URL
file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET
Files/root/ef9cacdf/e639667a/Newtonsoft.Json/Newtonsoft.Json.DLL. LOG:
Attempting download of new URL
file:///MyFolder/Web/bin/Newtonsoft.Json.DLL. WRN: Comparing the
assembly name resulted in the mismatch: Major Version ERR: Failed to
complete setup of assembly (hr = 0x80131040). Probing terminated.

解决方法

您的解决方案中有2个不同版本的JSON.NET库.要解决此问题,您应该将它们升级到最新版本.跟着这些步骤:

>开放式解决方案
>右键单击解决方案名称
>选择管理解决方案的Nuget包
>从菜单中选择更新
>更新JSON.NET包

这将解决您的问题.

.net – 无法加载文件或程序集’System.Web.Abstractions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35′

.net – 无法加载文件或程序集’System.Web.Abstractions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35′

我得到以下错误任何想法?
仅当控制器调用ValidateForm()方法时才会收到此错误消息.

无法加载文件或程序集’System.Web.Abstractions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35’或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配. (HRESULT异常:0x80131040)

解决方法

程序集的正确版本是3.5.0.0.我猜你正在使用针对这个程序集的自定义构建版本编译的东西.您可以使用 bindingRedirect来指示CLR加载正确版本的程序集.

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="System.Web.Abstractions"
                              publicKeyToken="31bf3856ad364e35"
                              culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0"
                             newVersion="3.5.0.0"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

20190620_二次开发 BarTender 打印机时,未能解析主引用 “Seagull.BarTender.Print, Version=1.0.0.0, Culture=neutral, pro...

20190620_二次开发 BarTender 打印机时,未能解析主引用 “Seagull.BarTender.Print, Version=1.0.0.0, Culture=neutral, pro...

错误提示:

严重性 代码 说明 项目 文件 行 禁止显示状态
警告 未能解析主引用 “Seagull.BarTender.Print, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86”,因为它对框架程序集 “System.IdentityModel.Selectors, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” 有间接依赖关系,而在当前目标框架中未能解析该程序集。“.NETFramework,Version=v2.0”。若要解决此问题,请移除引用 “Seagull.BarTender.Print, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86”,或将应用程序的目标重新指向包含 “System.IdentityModel.Selectors, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” 的框架版本。 

 

解决办法:

将.net Framework 调到 4.0

然后接下来有另一个报错:

转到配置文件,加上

参见:

https://docs.microsoft.com/zh-cn/dotnet/framework/configure-apps/file-schema/startup/startup-element

 

关于解决:未能加载文件或程序集“System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”...的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于'Abp.Zero.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' 方法 'Get' 没有实现、.net – 无法加载文件或程序集’Newtonsoft.Json,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其依赖项之一、.net – 无法加载文件或程序集’System.Web.Abstractions,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35′、20190620_二次开发 BarTender 打印机时,未能解析主引用 “Seagull.BarTender.Print, Version=1.0.0.0, Culture=neutral, pro...等相关内容,可以在本站寻找。

本文标签: