【发布时间】:2018-02-20 02:40:36
【问题描述】:
这个错误刚刚开始突然发生。使用 Visual Studio 2017,System.Net.Http.Formatting 问题已经好几年没有提出来了。
我只在网页上看到这条消息:
无法加载文件或程序集“System.Net.Http.Formatting-Cosmo”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (HRESULT 异常:0x80131040)
连同回溯:
=== Pre-bind state information ===
LOG: DisplayName = System.Net.Http.Formatting-Cosmo
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.Net.Http.Formatting-Cosmo | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/George/OneDrive/SignupList/SignupList/
LOG: Initial PrivatePath = C:\Users\George\OneDrive\SignupList\SignupList\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\George\OneDrive\SignupList\SignupList\web.config
LOG: Using host configuration file: C:\Users\George\OneDrive\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/George/AppData/Local/Temp/Temporary ASP.NET Files/vs/6cc2628d/51b3c1a6/System.Net.Http.Formatting-Cosmo.DLL.
LOG: Attempting download of new URL file:///C:/Users/George/AppData/Local/Temp/Temporary ASP.NET Files/vs/6cc2628d/51b3c1a6/System.Net.Http.Formatting-Cosmo/System.Net.Http.Formatting-Cosmo.DLL.
LOG: Attempting download of new URL file:///C:/Users/George/OneDrive/SignupList/SignupList/bin/System.Net.Http.Formatting-Cosmo.DLL.
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
似乎停止尝试在配置中查找具有正确版本的 DLL 的 System.Net.Http.Formatting。
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
我使用的是 ASP.NET 但不是 MVC,我不知道为什么需要 System.Net.Http.Formatting。 Cosmo 是我电脑的名称。我希望 -Cosmo 不是问题,我不明白为什么会出现。
我完成了 Stack Overflow 上一篇 4 年前的帖子中提到的所有事情 - Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. The system cannot find the path specified 没有解决它。我找到了其他帖子并使用了 Microsoft.AspNet.WebApi.Core V 5.2.4,它放置了 System.Net.Http.Formatting V 5.2.3.0。
System.Net.Http.Formatting Reference 上的 Local Copy 属性设置为 True。她重新收到的所有包裹。该项目已重新初始化。我已经尝试了我能找到的所有建议。
如果没有 Microsoft.AspNet.WebApi.Core,如果我编译我会收到编译错误,抱怨 System.Net.Http.Formatting 丢失。添加核心,错误消失,编译正常。由于依赖关系,我还必须使用 Microsoft.AspNet.WebApi.Core 删除并重新添加 Microsoft.AspNet.WebApi.WebHost。该网页在运行时会给出错误以及我的项目中每个 ASPX 文件的第一行。
我也有 Newtonsoft.Json,我见过与此相关的。
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2014.3.1209.45" newVersion="2014.3.1209.45" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<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>
<dependentAssembly>
<assemblyIdentity name="Google.Apis" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis.Core" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.25.0.0" newVersion="1.25.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
程序集正在寻找 System.Net.Http.Formatting-Cosmo 并尝试下载它。 System.Net.Http.Formatting 在 bin 中,我什至添加了 System.Net.Http.Formatting-Cosmo 以防万一。版本匹配。为什么找不到 bin DLL? -Cosmo 有问题吗?
令人费解。
乔治
【问题讨论】:
-
看到这个链接可能对你有帮助stackoverflow.com/questions/32668590/…