asp.net-web-api – Web Api:找不到System.Net.Http版本2.0.0.0
发布时间:2020-11-17 12:07:45 所属栏目:asp.Net 来源:互联网
导读:当我为WebApi安装NuGet包时,它给了我1.0.0.0版的System.Net.Http,但它引用了版本2. 我似乎无法找到我的生活版本2.当我下载.net 4.5时,我得到System.Net.Http版本4.0.315.x,但我不能使用它,因为Web Api程序集引用版本2.0.0.0. 有谁知道我在哪里可以找到这个版
当我为WebApi安装NuGet包时,它给了我1.0.0.0版的System.Net.Http,但它引用了版本2. 我似乎无法找到我的生活版本2.当我下载.net 4.5时,我得到System.Net.Http版本4.0.315.x,但我不能使用它,因为Web Api程序集引用版本2.0.0.0. 有谁知道我在哪里可以找到这个版本2.0.0.0?我已经尝试过NuGet包管理器,mvc4,.net 4.5,没有什么能给我版本2. 提前致谢. 解决方法在< system.web>下的Web.config文件中添加以下配置节点(假设您的应用程序在.NET 4.5上运行,targetFramework属性设置为4.5):<compilation targetFramework="4.5"> <assemblies> <add assembly="System.Net.Http,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" /> </assemblies> </compilation> 还要在< configuration>下的根级添加以下一个.节点: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> 这应该可以解决您的问题. (编辑:4S站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 在ASP.NET MVC中的LinkButton
- asp.net-mvc – Windows 8 VS2012 IISExpress Windows身份验
- ASP.NET中XML转JSON的方法实例
- asp.net-mvc-4 – MVC 4 Razor如果拆分div标签
- asp.net ajax实现无刷新验证码
- asp.net 文件上传实例汇总
- ASP.NET web.config中数据库连接字符串connectionStrings节
- ASP.Net:为什么我的按钮的点击/命令事件没有在转发器中绑定
- .net – asp:GridView文本框始终返回空值
- asp.net – Silverlight初始化错误2110 Internet Explorer
推荐文章
站长推荐
热点阅读