简体   繁体   中英

asp.net webapi vs asp.net mvc restlike actions

I've been taking a look at the asp.net webapi stuff and I'm curious to know what the tipping point is for using it over using a normal mvc controller that supports rest like urls.

I've done a bit of a search and can't find any articles that specifically talk about when is the most appropriate time to use each.

The separation is now:

If you need to spit out dynamic views (ie view gets rendered on the server typically using Razor) then use ASP.NET MVC. Historically you could provide data but Web API is richer (it supports content negotiation).

If you need to provide data , then use ASP.NET Web API. You could fit in the view support but it is not meant for it.


I can see these will be joined together as ASP.NET web stack in the future versions (not the upcoming release).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM