ASP.NET MVC 5比ASP.NET的WebAPI对于iOS应用,Andoir应用和的WebApp [英] ASP.NET MVC 5 vs ASP.NET WebAPI for iOS Apps, Andoir Apps and WebApps

查看:119
本文介绍了ASP.NET MVC 5比ASP.NET的WebAPI对于iOS应用,Andoir应用和的WebApp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要设计使用.NET框架的客户服务器架构。在未来的顾客会实现多个客户喜欢写在HTML,CSS和JavaScript(AngularJS)原生Android或iOS应用或正常Web Apps中。

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).

通过以​​下哪种方式可以实现我一个更加灵活和独立的接口来构建不同的技术就像我上面提到的客户呢?将 ASP.NET MVC 5 ASP.NET的WebAPI 更好的选择?

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?

推荐答案

我觉得你应该去ASP.Net的WebAPI,谋取几个原因:

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


  1. 网络API 有助于建立 REST-FUL 服务在 .NET框架,它也支持的内容协商(这是关于决定,可能是由客户端接受最好的回应格式的数据。它可能是JSON,XML,ATOM或其他格式的数据)的,自我的托管,不能在MVC。

  2. 的Web API还 负责返回像JSON,XML或基于在请求中的Accept头任何其他特定格式的数据的,你不担心。 MVC只能用JSON格式返回数据的 JsonResult

  3. Asp.Net的Web API是新的框架和核心ASP.NET框架的一部分。该模型结合,过滤器,路由和其他网页API存在的MVC特征是从MVC的不同而存在于新System.Web.Http组件。在MVC中,这些featues与System.Web.Mvc存在。因此,网页API也可以与Asp.Net并作为一个独立的服务层可以使用。

  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.

这篇关于ASP.NET MVC 5比ASP.NET的WebAPI对于iOS应用,Andoir应用和的WebApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆