我有一个小的MVC应用程序,用于练习,但现在我每次尝试调试时都会遇到错误:
Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies.
The system cannot find the path specified.
我已经用谷歌搜索过了,但找不到解决方案。我使用的是.NET 4.5。
它不能是DLL文件,因为我使用的是.Net 4.5。
发布于 2014-11-13 03:53:48
我找到了一个额外的
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.28.0" newVersion="2.2.28.0" />
</dependentAssembly>
在我的web.config里。去掉了它才能正常工作。我安装了一些其他的包,然后将其删除,导致了这个问题。
发布于 2016-01-31 10:13:41
user3919888为我指明了正确的方向,但我需要在包管理器控制台中运行Update-Package -reinstall Microsoft.AspNet.WebApi.Client
。Basic install本身不会识别问题,但会识别软件包已经安装,并且不会覆盖它。
我之所以发布这个答案,是因为这种情况发生得太少了,以至于我在记起上次做了什么之前,就用谷歌搜索并到达了这个页面。
发布于 2015-11-02 15:53:20
从web.config
中删除以下代码行解决了我的问题。请注意,在这个项目中,我没有使用WebApi组件。因此,对于其他人来说,这个解决方案可能不会像预期的那样工作。
<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>
https://stackoverflow.com/questions/22403650
复制相似问题