asp.net-mvc - 3.5 或 2.0 应用程序上的 ASP.NET Web API HttpClient?

标签 asp.net-mvc httpclient asp.net-web-api

我喜欢 ASP.NET Web API 中的 HttpClient。我可以在 3.5 或 2.0 中使用它吗?我的意思是在 4.0 之前的任何 .NET Framework 应用程序版本中。实际上,我有一个 ASP.NET 4.0 中的 ASP.NET Web API 应用程序。我需要从 3.5 框架内置的设备上使用这个应用程序。我知道我可以使用 WebClient/WebRequest,但是如果我可以使用 HttpClient 的东西那就太好了。

最佳答案

根据this ,

WebAPI requires .net 4. You can't use it on .net 3.5 (sp1 or not).

You also can't use the preview releases for production code as you don't have a "go-live" license, so even if you could get it to work, it wouldn't be legal. You need to use at least the ASP.NET WebAPI Beta to get a go-live license.

根据this ,

The HttpClient library was initially introduced in the "WCF REST Starter Kit" project, so you can download it from there. This project isn't supported anymore (most of its functionality has either made it into the framework or is now part of the Web API project), but the HttpClient from there works quite well.

关于asp.net-mvc - 3.5 或 2.0 应用程序上的 ASP.NET Web API HttpClient?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12173932/

相关文章:

asp.net - 网络API : No MediaTypeFormatter is available to read an object of type 'IEnumerable` 1' from content with media type ' text/plain'

asp.net-mvc - 脂肪 Controller : How do i make it slim?

java - 奇怪的 JAX-RS 行为

asp.net-mvc - 使用 knockout 将枚举绑定(bind)到组合框

ruby-on-rails - 为什么 Ruby File 类不包含 size 实例方法

android - 使用 httpclient 禁用/忽略 cookie

asp.net-mvc - 未在浏览器中创建响应 header 中的 Set-Cookie - 使用 http POST

ASP.NET Web API : The requested resource does not support http method 'GET'

asp.net-mvc - 如何在 httpcontext 中添加一个请求明智的变量

c# - 使用 Resharper 查找 ASP.NET MVC View 的所有用法