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 ...
随机推荐
- 蓝牙Ibeacon室内定位和微信摇一摇周边原理分析
苹果推出Ibeacon室内定位技术是为了弥补GPS无法覆盖室内定位这种场景.苹果意味着创新,在其推动下,蓝牙Ibeacon得到了极大的应用.而腾讯则是利用蓝牙Ibeacon在场景体验方面进行了创新,实 ...
- Swift学习--常量.变量.数据类型的使用(二)
一.Swift中的数组 //Swift中的数组 //NSArray *arr = @["",""]; //和OC数组的区别就是去掉前面的@ let arr11 ...
- jQuery点击事件绑定onClick和on()
一.静态绑定 (1)onclick方法 jsp代码 <button href="javascript:;" class="weui_btn weui_btn_min ...
- git常用命令,git版本控制和Xcode结合使用,用Xcode提交到github,github客户端使用
1.git常用命令 查看命令: 1.git --help 查看git所有命令 2.git clone -help 查看git clone命令的细节 3.git config -l 查看当前所有配置 ...
- JDBC编程 之 增删改查
JDBC编程之数据增加,更改,查询,删除 package com.good.jdbc; import java.sql.Connection; import java.sql.DriverManage ...
- Linux文件I/O学习
Linux内核的VFS子系统: 文件描述符 对于内核而言,所有打开的文件都通过文件描述符引用.文件描述符是一个非负整数.当打开一个现有文件或创建一个新文件时,内核向进程返回一个文件描述符.当读 ...
- Web Farm 和Web Garden
这两个都是提高网站性能的服务器端技术 1.Web Farm:如果应用程序被多个服务器托管,这种情况就可以称作Web Farm. 2.Web Garden: 指的是一个应用程序可以分成多个进程(w3wp ...
- MySQL 存储过程实例 与 ibatis/mybatis/hibernate/jdbc 如何调用存储过程
虽然MySQL的存储过程,一般情况下,是不会使用到的,但是在一些特殊场景中,还是有需求的.最近遇到一个sql server向mysql迁移的项目,有一些sql server的存储过程需要向mysql迁 ...
- javascript 特效实现(2)——回到顶部效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- hdu 4607 Park Visit 求树的直径
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4607 题目大意:给你n个点,n-1条边,将图连成一棵生成树,问你从任意点为起点,走k(k<=n) ...