http://www.dotnet-tricks.com/Tutorial/webapi/Y95G050413-Difference-between-ASP.NET-MVC-and-ASP.NET-Web-API.html

  • Asp.Net MVC is used to create web applications that returns both views and data but Asp.Net Web API is used to create full blown HTTP services with easy and simple way that returns only data not view.(ASP MVC返回view和数据,Asp.Net Web API只返回数据)
  • 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.(Web API不同形式的数据,比如xml,json等)
  • 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.(MVC只能返回json类型的数据)
  • In Web API the request are mapped to the actions based on HTTP verbs but in MVC it is mapped to actions name.(Web API的http request会根据谓词来map到具体的action上,而MVC根据action name去map到具体的action上)
  • 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.Httpassembly. 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 Web API的各个功能,比如model binding, filters, routing等是在System.Web.Http中实现的,而类似的MVC框架的功能是在System.Web.Mvc中实现的。也就是说Web API和Asp MVC是两套独立的体系)
  • You can mix Web API and MVC controller in a single project to handle advanced AJAX requests which may return data in JSON, XML or any others format and building a full blown HTTP service. Typically, this will be called Web API self hosting.(你可以将Web API和MVC在同一个工程中一起使用)
  • When you have mixed MVC and Web API controller and you want to implement the authorization then you have to create two filters one for MVC and another for Web API since boths are different.(如果你将Web API controller和MVC controller一起混合使用,在他们需要authorization的时候,你必须为实现各自的authorization机制)
  • Moreover, Web API is light weight architecture and except the web application it can also be used with smart phone apps.(Web API是轻量级的架构,可以用在手机程序中)

Asp.Net Web API VS Asp.Net MVC的更多相关文章

  1. ASP.NET Web API和ASP.NET Web MVC中使用Ninject

    ASP.NET Web API和ASP.NET Web MVC中使用Ninject 先附上源码下载地址 一.准备工作 1.新建一个名为MvcDemo的空解决方案 2.新建一个名为MvcDemo.Web ...

  2. 在ASP.NET Web API和ASP.NET Web MVC中使用Ninject

    先附上源码下载地址 一.准备工作 1.新建一个名为MvcDemo的空解决方案 2.新建一个名为MvcDemo.WebUI的空MVC应用程序 3.使用NuGet安装Ninject库   二.在ASP.N ...

  3. 既生瑜何生亮?ASP.NET MVC VS ASP.NET Web API

    Asp.net MVC 与 Asp.net Web API 区别 在我们开发一些web应用时,我们一样可以在MVC Framework 中使用JsonResult 来返回JSON数据,同样也可以处理一 ...

  4. MVC项目实践,在三层架构下实现SportsStore-09,ASP.NET MVC调用ASP.NET Web API的查询服务

    ASP.NET Web API和WCF都体现了REST软件架构风格.在REST中,把一切数据视为资源,所以也是一种面向资源的架构风格.所有的资源都可以通过URI来唯一标识,通过对资源的HTTP操作(G ...

  5. Asp.net MVC 与 Asp.net Web API 区别

    Asp.Net Web API VS Asp.Net MVC 1.Asp.net MVC 是用来创建返回视图(Views)与数据的Web应用,而Asp.net Web API是一种简单轻松地成熟的HT ...

  6. ASP.NET Web API 开篇示例介绍

    ASP.NET Web API 开篇示例介绍 ASP.NET Web API 对于我这个初学者来说ASP.NET Web API这个框架很陌生又熟悉着. 陌生的是ASP.NET Web API是一个全 ...

  7. 使用ASP.NET Web Api构建基于REST风格的服务实战系列教程【开篇】【持续更新中。。。】

    最近发现web api很火,园内也有各种大神已经在研究,本人在asp.net官网上看到一个系列教程,原文地址:http://bitoftech.net/2013/11/25/detailed-tuto ...

  8. ASP.NET Web API 应用教程(一) ——数据流使用

    相信已经有很多文章来介绍ASP.Net Web API 技术,本系列文章主要介绍如何使用数据流,HTTPS,以及可扩展的Web API 方面的技术,系列文章主要有三篇内容. 主要内容如下: I  数据 ...

  9. ASP.NET Web API 2框架揭秘

    ASP.NET Web API 2框架揭秘(.NET领域再现力作顶级专家精讲微软全新轻量级通信平台) 蒋金楠 著   ISBN 978-7-121-23536-8 2014年7月出版 定价:108.0 ...

随机推荐

  1. php引入公用部分html出现了一行空白(原创)

    在导入公用部分html(客服信息)时,莫名其妙出现了一行空白,样式,html均无问题 后来才发现是html多了一行空白 <div class="ad-module-item3 fn-m ...

  2. Debian7.7 wheezy 中源码安装emacs24

    我用的是ARM版本,竟然没有最新的emacs 24,很多第三方插件不能用,果断重新编译个1.追加软件源 deb-src http://ftp.cn.debian.org/debian/ wheezy ...

  3. 编译APK时出现 This attribute must be localized 的两种解决方法 免修改xml

    下面两种方法可以让你不需要修改APP XML字符串的条件下忽略 This attribute must be localized 的 Android 源码编译时的错误警告. 1.修改当前APP的 An ...

  4. Objective-C ,ios,iphone开发基础:几个常用类-NSString

    第一个字符串: //必须在字符串的前面加上@符号, NSString* str=@"shouqiang_Wei";//输出以%@输出. NSLog(@"%@", ...

  5. JDK的安装

    安装jdk解压拷贝过来的jdk(1.6版本)压缩包 cd /usr/local/tar xzvf /tmp/jdk.tgz 修改环境变量vi /etc/profile 加入如下内容export JAV ...

  6. MySQL中的保留字

    本文转载自:http://www.cnblogs.com/lawdong/archive/2010/08/08/2357903.html ADD ALL ALTER ANALYZE AND AS AS ...

  7. 关于解决form表单记录上次保存填写记录清空

    传进来的是一个HTML的Table的ID. function doReset(tableId){ var tbl_content = document.getElementById(tableId); ...

  8. Git CMD - reset: Reset current HEAD to the specified state

    命令格式 git reset [-q] [<tree-ish>] [--] <paths>…​ git reset (--patch | -p) [<tree-ish&g ...

  9. 【转载】Apache Kafka:下一代分布式消息系统

    http://www.infoq.com/cn/articles/kafka-analysis-part-1 Kafka是由LinkedIn开发的一个分布式的消息系统,使用Scala编写,它以可水平扩 ...

  10. 如何查看Windows8.1计算机体验指数评分

    如果你已经安装使用了Windows 8.1,你就会发现自从Vista时代开始的计算机体验评分消失了,在文章<微软取消Windows 8 计算机评分功能>中,我猜测了微软取消评分功能的可能原 ...