转 Difference between WCF and Web API and WCF REST and Web Service
http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-REST-and-Web-Service.html
The .Net framework has a number of technologies that allow you to create HTTP services such as Web Service, WCF and now Web API. There are a lot of articles over the internet which may describe to whom you should use. Now a days, you have a lot of choices to build HTTP services on .NET framework. In this article, I would like to share my opinion with you over Web Service, WCF and now Web API. For more information about Web API refers What is Web API and why to use it ?.
Web Service
It is based on SOAP and return data in XML form.
It support only HTTP protocol.
It is not open source but can be consumed by any client that understands xml.
It can be hosted only on IIS.
WCF
It is also based on SOAP and return data in XML form.
It is the evolution of the web service(ASMX) and support various protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ.
The main issue with WCF is, its tedious and extensive configuration.
It is not open source but can be consumed by any client that understands xml.
It can be hosted with in the applicaion or on IIS or using window service.
WCF Rest
To use WCF as WCF Rest service you have to enable webHttpBindings.
It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.
To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files
Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified
It support XML, JSON and ATOM data format.
Web API
This is the new framework for building HTTP services with easy and simple way.
Web API is open source an ideal platform for building REST-ful services over the .NET Framework.
Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats)
It also supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing that makes it more simple and robust.
It can be hosted with in the application or on IIS.
It is light weight architecture and good for devices which have limited bandwidth like smart phones.
Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.
To whom choose between WCF or WEB API
Choose WCF when you want to create a service that should support special scenarios such as one way messaging, message queues, duplex communication etc.
Choose WCF when you want to create a service that can use fast transport channels when available, such as TCP, Named Pipes, or maybe even UDP (in WCF 4.5), and you also want to support HTTP when all other transport channels are unavailable.
Choose Web API when you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
Choose Web API when you want to expose your service to a broad range of clients including browsers, mobiles, iphone and tablets.
转 Difference between WCF and Web API and WCF REST and Web Service的更多相关文章
- Difference between WCF and Web API and WCF REST and Web Service
		
The .Net framework has a number of technologies that allow you to create HTTP services such as Web S ...
 - WCF、Web API、WCF REST、Web Service的区别
		
Difference between WCF and Web API and WCF REST and Web Service The .Net framework has a number of ...
 - WCF 、Web API 、 WCF REST 和 Web Service 的区别
		
WCF .Web API . WCF REST 和 Web Service 的区别 The .Net framework has a number of technologies that allow ...
 - [Solution] 使用Autofac在MVC、Web API、WCF中实现IOC
		
本来想聊一下面试过程的,1个星期面了6家,4家当场给offer,2家技术通过(1家没下文,1家复试).从中也学习到一些东西,先还是继续Coding吧. 官网:http://autofac.org/ 下 ...
 - 选择Web API还是WCF
		
ASP.NET WCF是.NET平台服务开发的一站式框架,那么为什么还要有ASP.NET Web API呢?简单来说,ASP.NET Web API的设计和构建只考虑了一件事情,那就是HTTP,而WC ...
 - Web API 和 WCF 的比较
		
现在有很多可用的技术允许你创建被不同客户端所消费的服务,这些客户端可能是Web应用程序.Windows应用程序和移动应用等.服务可以支持http协议或者其他协议.接下来的讨论仅限于ASP.NET We ...
 - ASP.NET Web API——选择Web API还是WCF
		
WCF是.NET平台服务开发的一站式框架,那么为什么还要有ASP.NET Web API呢?简单来说,ASP.NET Web API的设计和构建只考虑了一件事情,那就是HTTP,而WCF的设计主要是考 ...
 - WCF、Web API、WCF REST、Web Service
		
WCF.Web API.WCF REST.Web Service 区别 Web Service It is based on SOAP and return data in XML form. It ...
 - WCF、Web API、WCF REST、Web Service 区别
		
Web Service It is based on SOAP and return data in XML form. It support only HTTP protocol. It is no ...
 
随机推荐
- WPF之UseLayoutRounding和SnapsToDevicePixels
			
最近在工作中看别的朋友XML代码时,发现SnapsToDevicePixels 属性然后通过查询资料了解其作用 1)UserLayoutRounding为False,导致控件布局相对屏幕若不是整数则不 ...
 - synchronized关键字使用剖析
			
synchronized关键字,代表这个方法加锁,相当于不管哪一个线程(例如线程A),运行到这个方法时,都要检查有没有其它线程B(或者C. D等)正在用这个方法,有的话要等正在使用synchroniz ...
 - 【HTML5】websocket 初识
			
什么是WebSocket API? WebSocket API是下一代客户端-服务器的异步通信方法.该通信取代了单个的TCP套接字,使用ws或wss协议,可用于任意的客户端和服务器程序.WebSock ...
 - 简单的C#线程开发实例(隔一秒改变一下Label的Text)
			
要实现的效果:点击按纽,窗口上的label上出现1~100数字的变化. 第一个实例(把窗口上的label上文字改成0): using System; using System.Windows.Form ...
 - Struts之ForwardAction
			
在Struts中,通过action跳转jsp,但是有时希望仅仅只是跳转页面,而不需要action,这时可以用ForwardAction. 定义一个仅仅是跳转的ForwardAction如下: < ...
 - Spring中后台字符串国际化
			
1.在工程的资源文件夹(source folder)中建立三个properties文件:messages.properties(默认).messages_zh_CN.properties(中文).me ...
 - 网络笔记01-2 scoket
			
scoket: 1.socket /** 第一个参数(domain): 表示用什么协议 AF_INET 为IPV4开发 第二个参数(type): 表示scoket为什么类型SOCK_STREAM为TC ...
 - 我的cnblogs设置代码
			
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
 - C语言基础:两个变量交换值的方法
			
学习任何语言基础时,两个数值得交换是必须掌握的,下面是3种不同的方式(c语言) 方法一:利用数学的计算技巧 #include <stdio.h> int main() { , b = ; ...
 - 如何用js获取当前url的参数值
			
<script language = javascript> function request(paras){ var url = location.href; var paraStrin ...