Difference between MVC application and MVC WEB API Application

•Web API does not share the Model-View-Controller design of MVC

•Web API directly renders the resulting model object as the response

•Base Class is ApiController where as in MVC we have Controller

•Methods in the controller return raw objects rather than views (or other action helper objects)

•Web API controllers by default dispatch to actions by HTTP verb where as MVC controllers always dispatch to actions by name.

•ApiController is defined in the namespace System.Web.Http and MVC controller is defined in System.Web.Mvc

• Web API controllers are asynchronous by design.

• Different Execution Pipeline because rather than having access to a Response object, API controllers are expected to return a response object of type HttpResponseMessage

•Only a single value can come from the body, and that value must represent the entirety of the body

•Incoming parameters which are not part of the body are handled by a model binding system that similar to the one included in MVC. Incoming and outgoing bodies, on the other hand, are handled by a brand new concept called formatters.

•In MVC When an action returns a raw object, Web API will automatically convert it into a structured response in the desired format (like JSON or XML) using a feature of Web API called Content Negotiation.

Published by Nirbhay

Technology Geek,Blogger,Reviewer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: