0

What features of ASP.NET Web API do not already exist in ASP.NET MVC?

Personally I think that you can accomplish the same by using Routing and a Custom Action Result.

Is it just the ability to self host it?

Thank you, Radu

Radu Negrila
  • 627
  • 1
  • 6
  • 11
  • it is not a duplicate. i am also interested why do we need asp.net web api if we already have asp.net mvc. what does it add to the table? – Radu Negrila Mar 20 '13 at 13:15

2 Answers2

4
  1. Unlike ASP.NET MVC, ASP.NET Web API does not require ASP.NET (nor IIS) to run,
  2. Unlike WCF, Web API does not abstract transport level mechanisms - it has been built with HTTP services in mind and it embraces HTTP protocol.

Ad 1. Imagine you are building a mobile app where user should be able to browse and download files from his local PC. You wouldn't want to use ASP.NET MVC to expose services because you cannot assume that the customer has a working IIS installation. You can use Web API though and host HTTP service in a windows service. (and also provide user with an installer that sets up that service).

Ad 2. Leaving abstractions behind means less complicated API, less configuration and richer support for HTTP specific concepts.

Piotr Walat
  • 971
  • 7
  • 9
0

ASP.NET MVC is a HTTP stack optimized to server content to web browsers. If your client applications are not web browsers then Web API may turn out to be a more flexible option.

Darrel Miller
  • 139,164
  • 32
  • 194
  • 243