다음을 통해 공유


ASP.NET Web API and HttpClient Available on NuGet

If you don’t need the full ASP.NET MVC 4 installer with project and item templates for Visual Studio 2010 then you can download the various ASP.NET Web API packages directly from NuGet (see list of packages below). If you are new to NuGet then it is a Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework (check out the NuGet overview).

NuGet Packages

Here are the relevant NuGet packages depending on what you want to build:

  1. Web API hosted in ASP.NET: AspNetWebApi
  2. Self-hosted Web API: AspNetWebApi.Selfhost
  3. HttpClient including XML and JSON formatters: System.Net.Http.Formatting
  4. JsonValue for navigating and manipulating JSON: System.Json

Additional Information

  1. Release notes for installation instructions and to find out what’s new.
  2. ASP.NET Web API home complete with docs, samples, tutorials and videos.

Have fun!

Henrik

del.icio.us Tags: asp.net,webapi,mvc,rest,httpclient

Comments

  • Anonymous
    February 20, 2012
    Hello. Is "ASP.NET Web API" open source?What's the difference "ASP.NET Web API" and "WCF Web API"?

  • Anonymous
    February 20, 2012
    If you check the codeplex project for WCF web API there is an announcement. http://wcf.codeplex.com/

  • Anonymous
    February 20, 2012
    I tried to install AspNetWebApi using Nuget, and make a simple controller in an existing MVC 3 app. It would complain that System.Json was not found. Is there a dependency on System.Json for AspNetWebApi? Manually doing Install-package System.Json solved the problem

  • Anonymous
    February 20, 2012
    John, yes we forgot to add System.Json as a package dependency. Manually adding it works.

  • Anonymous
    February 22, 2012
    I can't find the EnableTestClient and EnableHelpPage settings. Where'd they go? And the spiffy MapServiceRoute<T> method is gone too? How do I host WebAPI services in a classic ASP.NET WebForms application?

  • Anonymous
    February 23, 2012
    I would love to see System.Json being ported to .net 3.5 sp1 client profile. Would be even better if it could go down to .net 2.0. For platforms that doesn't support dynamic we could continue to use IDictionary<string,object> as JsonObject and IList<object> as JsonArray. This would really be helpful for those creating libraries such as Facebook/Twitter targeting multiple platforms sl4/wp7/winrt/.net3.5/.net4.0.

  • Anonymous
    February 24, 2012
    Is there any plans to release an HttpClient library for Silverlight?  Idea when is gonna be available? BTW the ASP.NET Web API rocks.

  • Anonymous
    February 24, 2012
    Eric, help page and test client didn't make it into beta but we are looking at it now.

  • Anonymous
    February 24, 2012
    The comment has been removed

  • Anonymous
    February 29, 2012
    Is there a way to pass a complex type (ArrayList, etc) as a parameter to the Web API?  I am wanting to create an API that can be called from both Web and WinForms.  Not sure how to pass an ArrayList as a parameter from WinForms.

  • Anonymous
    March 01, 2012
    how do I use xml string in post method?. I can't map it to a class since the format is unknown. webapi fails with mediaformat error.

  • Anonymous
    March 04, 2012
    You can use StringContent and then set the media type explicitly to "application/xml".

  • Anonymous
    March 05, 2012
    I couldn't get StringContent working in post method. I tried removing the json formatter and adding a new media formatter with application/xml. I am getting various errors depending on what I pass in accept and content-type.