ASP.NET MVC 5 vs ASP.NET WebAPI for iOS Apps, Andoir Apps and WebApps [closed]

亡梦爱人 提交于 2020-01-16 02:25:13

问题


I need to design a customers server architecture using the .NET framework. In the future the customer will implement several clients like native Android or iOS Apps or normal Web Apps written in HTML, CSS and JavaScript (AngularJS).

With which of the following approaches can I implement a more flexible and independent interface to clients built on different technologies like I mentioned above? Would be ASP.NET MVC 5 or ASP.NET WebAPI the better choice?

Can I use both of them or is a solution with one of them even not possible?


回答1:


I think you should go for ASP.Net WebAPI, Enlisting few reasons why :

  1. Web API helps to build REST-ful services over the .NET Framework and it also support content-negotiation(it's about deciding the best response format data that could be acceptable by the client. it could be JSON,XML,ATOM or other formatted data), self hosting which are not in MVC.
  2. Web API also takes care of returning data in particular format like JSON,XML or any other based upon the Accept header in the request and you don't worry about that. MVC only return data in JSON format using JsonResult.
  3. Asp.Net Web API is new framework and part of the core ASP.NET framework. The model binding, filters, routing and others MVC features exist in Web API are different from MVC and exists in the new System.Web.Http assembly. In MVC, these featues exist with in System.Web.Mvc. Hence Web API can also be used with Asp.Net and as a stand alone service layer.


来源:https://stackoverflow.com/questions/34762633/asp-net-mvc-5-vs-asp-net-webapi-for-ios-apps-andoir-apps-and-webapps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!