Saturday, April 21, 2012

What is ASP.Net Web API

ASP.Net Web APIs are extension to existing ASP.Net  capabilities, released as subset of MVC4 that implements a subset of OData specification to ASP.Net  with the intention of facilitating RESTFull application development using ASP.Net and MVC.

Getting Started with ASP.NET Web API Web Api is available as standalone installation for VS2010 and and built in with Vs2011.  
  • Installation 
    • Download and Install VS2010
    • Download and Install MVC4 and ASP.Net WebAPI  for VS 2010 Alternatively 
    • Install VS2011 (Has Built-in support)

ASP.Net Web API Vs WCF Data Services
                ASP.Net web AP
WCF Data Service
1.      Use this when you want to build a application that will be driven by URL such as MVC based UI application
2.      This is used to build an web application that confirms to REST but not targets to OData protocol but confirms to subset of protocol          
1.      Theses are pure backed services and usually consumed by some UI application.
2.      Fundamental use of Data Service is to expose plain data base tables and relation between the tables as XML response stream so that large amount of data can be transferred across heterogeneous consumers

Additional Collate
  1. WCF Data Services requires something like a DataContext. Web API doesn't.
  2. Web API is a way to add a pure http API to your application. It can be hosted in MVC, webforms, in a console app etc. 
  3. It's much simpler to implement an http API with Web API (very similar to MVC controllers with routing being similar).
  4. If you expose an IQueryable, you get basic ODATA support (like filtering, ordering etc.)
  5. In other words I would say that both data service and WebAPI both confirms to REST but data service also confirms to OData(That is further extention of REST ), while WebAPI do not even target it


Alternative Titles for this article
ASP.Net Web API Vs WCF Data Services 
What is ASP.Net web API
Web API and MVC 4.0

No comments:

Post a Comment