While building up your web application using MVC, numerous designers got confused when to use Web API, since MVC system can likewise return JSON data  by using JsonResult and can also handle simple AJAX requests.
There
are many differences between MVC and Web API, including:
- We can use the MVC for
     developing  the Web application that replies as both data and views
     but the Web API is used for generating the HTTP services that replies only
     as data.
- In the Web API the request
     performs tracing with the actions depending on the HTTP services but the
     MVC request performs tracing with the action name.
- The Web API returns the data in
     various formats, such as JSON, XML and other format based on the accept header
     of the request. But the MVC returns the data in the JSON format by using
     JSONResult.
- The Web API supports content
     negotiation, self hosting. All these are not supported by the MVC.
- The Web API includes the
     various features of the MVC, such as routing, model binding but these
     features are different and are defined in the "System.Web.Http"
     assembly. And the MVC features are defined in the "
     System.Web.Mvc" assembly.
- The Web API helps the creation
     of RESTful services over the .Net Framework but the MVC does not support.


 
 
 







.gif)
0 Comments