Asp.net web API is the Microsoft framework for building HTTP Service that can be consumed by broad range of client like window application, Web Form Application, WPF, Mobile, Tablet and smart TV.
It is very easy to learn if you are knowing some basic concept of asp.net MVC framework. It is very much similar to asp.net MVC.
It contains the MVC framework features like Routing, Controller, Action Result, Filter, Model binders, IOC containers or dependency injection.
(Note: Image taken from Microsoft site)
What are the advantages of web API as compare to other service?
There are many approach to create the service in Microsoft platform like Web Service and WCF. This two services were so popular in old days. Still now in legacy application we will use this two service. Nowadays people are using the application in different devices like PC, Tablet, Smart phone, smart TV and other devices.
If we will develop the service using old web service it will be very difficult to reach the broad ranges of devices. So to make the developer life easy Microsoft developed the new framework i.e. Asp.net Web API
It has the following advantages
1. It targets the broad range of client devices
2. It doesn’t have tedious and extensive configuration like WCF REST service.
3. It is light weight architecture and good for devices which have limited bandwidth like smart phones and tablet.
4. It is open source
What are the Asp.net Web API Characteristics?
1. ASP.NET Web API is an ideal platform for building RESTful services.
2. ASP.NET Web API is built on top of ASP.NET and supports ASP.NET request/response pipeline
3. ASP.NET Web API maps HTTP verbs to method names.
4. ASP.NET Web API supports different formats of response data. Built-in support for JSON, XML, BSON format.
5. ASP.NET Web API can be hosted in IIS, Self-hosted or other web server that supports .NET 4.0+.
6. ASP.NET Web API framework includes new HttpClient to communicate with Web API server. HttpClient can be used in ASP.MVC server side, Windows Form application, Console application or other apps.
What are the difference between WCF and Asp.net Web API?
When to use WCF?
These are the following scenario to use WCF
1. If you are using .Net 3.5 or below
2. If your service needs to support multiple protocols such as HTTP, TCP, Named pipe.
3. If you want to build service with WS-* standards like Reliable Messaging, Transactions, Message Security.
4. If you want to use Request-Reply, One Way, and Duplex message exchange patterns.
When to use Web API?
These are the following scenario to use WCF
1. If you are using .NET framework 4.0 or above.
2. If you want to build a service that supports only HTTP protocol.
3. If you want to build RESTful HTTP based services.
4. If you are targeting the broad range of device like PC, Mobile,Tablet and smart TV etc.