WCF与ASMX Web服务差异比较[译]
First of all, it needs to understand that WCF Service provides all the capabilities of .NET web servies and further extends it.
首先需要了解的是,WCF服务提供了.net web 服务的所有功能,并且对其有所扩展。
Simple and basic difference is that ASMX web service is designed to send and receive messages using SOAP over HTTP only. While WCF service can exchange messages using any format (SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc).
ASMX Web服务用于使用HTTP协议进行SOAP消息的接收和发送而设计。但是WCF服务则可以使用任何消息格式(SOAP默认),任何传输协议进行数据交互(HTTP,TCP/IP,MSMQ,命名管道等)。
ASMX is simple but limited in many ways as compared to WCF.
ASMX很简单但是和WCF比起来,却存在诸多限制。
1.ASMX web services can be hosted only in IIS while WCF service has all the following hosting options:
a. IIS
b. WAS (Windows Process Activation Services)
c. Console Application
d. Windows NT Services
e. WCF provided Host
1.ASMX Web服务只能够被IIS寄宿,但是WCF服务却可以有如下的寄宿方式:
a.IIS
b.WAS(Windows Process Activation Services Windows进程激活服务)
c.控制台程序
d.Windows NT服务
e.WCF自寄宿
2.ASMX web services support is limited to HTTP while WCF supports HTTP, TCP, MSMQ, NamedPipes.
2.ASMX web服务只能支持HTTP传输,但是WCF支持HTTP,TCP,MSMQ,命名管道。
3.ASMX Security is limited. Normally authentication and authorization is done using IIS and ASP.NET security configuration and transport layer security.For message layer security, WSE can be used.
WCF provides a consistent security programming model for any protocol and it supports many of the same capabilities as IIS and WS-* security protocols, additionally, it provides support for claim-based authorization that provides finer-grained control over resources than role-based security.WCF security is consistent regardless of the host that is used to implement WCF service.
3.ASMX在安全控制方面功能有限,包括普通的验证,基于IIS的验证,Asp.net安全配置,传输层安全控制。对于应用层安全来说,可以使用WSE来进行。
WCF则为所有的传输协议提供一致的安全验证模块,同时它支持类似于IIS和WS-*的安全协议,此外,它还支持提供比role-based更加细粒度的针对资源操控的Claim-based验证. WCF安全验证和寄宿主体无关。
4.Another major difference is that ASMX web services uses XmlSerializer for serialization while WCF uses DataContractSerializer which is far better in performance than XmlSerializer.
Key Issues with XmlSerializer in serializing .NET types to xml are:
a. Only public fields or properties of the .NET types can be translated to Xml.
b. Only the classes that implement IEnumerable can be translated.
c. Classes that implement IDictionary, such as Hashtable cannot be serialized.
4.另外一个主要的区别是,ASMX Web服务使用XmlSerializer进行序列化,但是WCF使用DataContractSerializer。后者在性能上完爆。
对于XmlSerializer进行.NET类型序列化来说,问题有以下几点:
a.只有PUBLIC字段或者属性才能够被转换成xml
b.只有实现了IEnumerable接口的类才能够被转化。
c.只有实现了IDictionary的类才能够被转化。比如说HashTable
WCF与ASMX Web服务差异比较[译]的更多相关文章
- 项目中使用WCF替换asmx Web service总结
以前项目解决方案中,用http协议的asmx Web service作服务器数据访问入口,在SoapHeader中写入用户名和加盐密码进行身份认证. http asmx服务是明文传输,传输过程中数据很 ...
- WCF服务部署到IIS上,然后通过web服务引用方式出现错误的解决办法
本文转载:http://www.cnblogs.com/shenba/archive/2012/01/06/2313932.html 昨天在用IIS部署一个WCF服务时,碰到了如下错误: 理解了文档内 ...
- 使用 ServiceStack 构建跨平台 Web 服务
本文主要来自MSDN杂志<Building Cross-Platform Web Services with ServiceStack>,Windows Communication Fou ...
- ASP.Net Web 服务 – 如何使用会话状态
在上次博客帖子中,我们讨论了客户端对web服务的使用.在这篇文章中我们将复习一下如何使用web服务的会话状态. 这是上一篇文章的延续.因此请迅速的回顾之前的文章以便有一个清晰的概念. 在web服务中要 ...
- 使用 ServiceStack 构建跨平台 Web 服务(转)
出处:http://www.cnblogs.com/shanyou/p/3348347.html 本文主要来自MSDN杂志<Building Cross-Platform Web Service ...
- WCF、WebAPI、WCFREST和Web服务的差异 ASP.NETMVC和ASP.NETWebAPI的差异
WCF.WebAPI.WCFREST和Web服务的差异: Web服务 它是基于SOAP和XML的形式返回数据. 它仅支持HTTP协议. 它是开放源,但是不消耗任何客户端可以同时理解XML. 它可以仅在 ...
- 从开发的角度比较 ASP.NET Web 服务与 WCF
Windows Communication Foundation (WCF) 具有一个 ASP.NET 兼容模式选项,用户使用此选项可以对 WCF 应用程序进行编程和配置,使其像 ASP.NET We ...
- WCF入门(三)---WCF与Web服务/Web Service
下面列出了WCF和Web服务之间存在一些重大差异. 属性:WCF服务是通过定义ServiceContract和OperationContract属性,而在Web服务,WebService和WebMet ...
- wcf通过webHttpBinding方式发布rest web服务
<system.serviceModel> <services> <service name="ServiceUpdater.ServiceUpdate&quo ...
随机推荐
- JSP入门&会话技术
一.JSP 1.jsp技术 jsp是sun提供动态web资源开发技术.为了解决在Servlet中拼写html内容css.js内容十分不方便的问题,sun提供了这样一门技术.如果说S ...
- Linux线程学习(一)
一.Linux进程与线程概述 进程与线程 为什么对于大多数合作性任务,多线程比多个独立的进程更优越呢?这是因为,线程共享相同的内存空间.不同的线程可以存取内存中的同一个变量.所以,程序中的所有线程都可 ...
- Openstack python api 学习文档 api创建虚拟机
Openstack python api 学习文档 转载请注明http://www.cnblogs.com/juandx/p/4953191.html 因为需要学习使用api接口调用openstack ...
- VMware虚拟机网络环境类型
0x01. VMware Ubuntu虚拟机网络环境 ① Bridge桥接模式:虚拟机与物理机的IP同在一个网段:虚拟机独立且地位与物理机相同:虚拟机可直接访问物理机以及物理机相连的外部网络的主机或网 ...
- js日期时间函数
日期时间脚本库方法列表 Date.prototype.isLeapYear 判断闰年Date.prototype.Format 日期格式化Date.prototype.DateAdd 日期计算Date ...
- oracle归档日志写满错误解决方法
最近一年,手头上负责的项目要部署到很多个地方,由于项目组里没有人对oracle比较熟悉,只能给自己增加一个DBA的角色了.由于短时间内要部署很多单位,备份策略没有设置好,结果过了一个月,用户报告程序开 ...
- python 练习购物车小程序
# -*- coding:utf-8 -*- shp = [ ['iphone',5000], ['offee',35], ['shoes',800] ] pric_list = [] e = int ...
- android自定义radiobutton样式文字颜色随选中状态而改变
主要是写一个 color selector 在res/建一个文件夹取名color res/color/color_radiobutton.xml <selector xmlns:android= ...
- Android资源下载
各个版本,在线源码: http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/ ...
- Java基础の乱弹琴一:assert关键字
一.概述 assert:表示断言 二.语法 在Java中,assert关键字是从JAVA SE 1.4 引入的,为了避免和老版本的Java代码中使用了assert关键字导致错误,Java在执行的时候默 ...