Difference between Web Api and MVC


MVC and Web-Api both are new booming technology of Asp.Net .some difference between of them are below:

  • Mvc stands for model, view and control which means mvc used to create web application that returns integrated view and data both.
  • Web Api stands for web Application program interface and web api is used to create fully independent HTTP services (get, set, delete)with easy and simple way that returns only data not view.
  • Web API requests are mapped to the  HTTP methods but in MVC it is mapped to actions name directly.
  • Web API also takes care of returning data in various format like json, xml and other formats while MVC only returns in json format using of json Result.
  • We can use Controller, Bussiness Logic and Data base layer (various layered) architecture in mvc for writing the Bussiness logic and database logic while MVC uses only controller for writing the logic.
  • Web api http service based architecture can also be called from mobile apps, desktop applications connected to internet.
  • Since web api is service based architecture so it can be accessed simultaneously from various ways using of different platform.
  • In case of mvc Controllers usually return a View (i.e. HTML response) to browser requests. Web APIs on the other hand are usually made to be consumed by other applications. If you want to allow other applications to access your data / functionality, you can create a Web API to facilitate this access.
  • For example of web api, Facebook has an API in order to allow App developers to access information about users using the facebook App.


Leave a comment

Your email address will not be published. Required fields are marked *