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服务差异比较[译]的更多相关文章

  1. 项目中使用WCF替换asmx Web service总结

    以前项目解决方案中,用http协议的asmx Web service作服务器数据访问入口,在SoapHeader中写入用户名和加盐密码进行身份认证. http asmx服务是明文传输,传输过程中数据很 ...

  2. WCF服务部署到IIS上,然后通过web服务引用方式出现错误的解决办法

    本文转载:http://www.cnblogs.com/shenba/archive/2012/01/06/2313932.html 昨天在用IIS部署一个WCF服务时,碰到了如下错误: 理解了文档内 ...

  3. 使用 ServiceStack 构建跨平台 Web 服务

    本文主要来自MSDN杂志<Building Cross-Platform Web Services with ServiceStack>,Windows Communication Fou ...

  4. ASP.Net Web 服务 – 如何使用会话状态

    在上次博客帖子中,我们讨论了客户端对web服务的使用.在这篇文章中我们将复习一下如何使用web服务的会话状态. 这是上一篇文章的延续.因此请迅速的回顾之前的文章以便有一个清晰的概念. 在web服务中要 ...

  5. 使用 ServiceStack 构建跨平台 Web 服务(转)

    出处:http://www.cnblogs.com/shanyou/p/3348347.html 本文主要来自MSDN杂志<Building Cross-Platform Web Service ...

  6. WCF、WebAPI、WCFREST和Web服务的差异 ASP.NETMVC和ASP.NETWebAPI的差异

    WCF.WebAPI.WCFREST和Web服务的差异: Web服务 它是基于SOAP和XML的形式返回数据. 它仅支持HTTP协议. 它是开放源,但是不消耗任何客户端可以同时理解XML. 它可以仅在 ...

  7. 从开发的角度比较 ASP.NET Web 服务与 WCF

    Windows Communication Foundation (WCF) 具有一个 ASP.NET 兼容模式选项,用户使用此选项可以对 WCF 应用程序进行编程和配置,使其像 ASP.NET We ...

  8. WCF入门(三)---WCF与Web服务/Web Service

    下面列出了WCF和Web服务之间存在一些重大差异. 属性:WCF服务是通过定义ServiceContract和OperationContract属性,而在Web服务,WebService和WebMet ...

  9. wcf通过webHttpBinding方式发布rest web服务

    <system.serviceModel> <services> <service name="ServiceUpdater.ServiceUpdate&quo ...

随机推荐

  1. 【原】训练自己haar-like特征分类器并识别物体(2)

    在上一篇文章中,我介绍了<训练自己的haar-like特征分类器并识别物体>的前两个步骤: 1.准备训练样本图片,包括正例及反例样本 2.生成样本描述文件 3.训练样本 4.目标识别 == ...

  2. iOS之 动态热修补技术JSPatch

    所谓动态热修补就是把能够导致app 崩溃的严重bug,提交新版本到appstore 审核速度太慢影响用户使用,这时候就可以利用 JSPatch 可以让你用 JavaScript 书写原生 iOS AP ...

  3. json深度详解及org.json库

    了解json  (Javascript Object Notation) 网站:http://json.org/ english JSON (JavaScript Object Notation) i ...

  4. Struts中的OGNL和EL表达式笔记

    Struts中的OGNL和EL表达式笔记 OGNL(Object-Graph Navigation Language),可以方便的操作对象属性的表达式语言. 1.#符号的用途 一般有三种方式: 1.1 ...

  5. wireshark安装

    原文链接地址:http://blog.csdn.net/holandstone/article/details/47026213 Wireshark下载地址:https://www.wireshark ...

  6. java微信接口之四—上传素材

    一.微信上传素材接口简介 1.请求:该请求是使用post提交地址为: https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=A ...

  7. cocos2d-x之加速度传感器初试

    bool HelloWorld::init() { if ( !Layer::init() ) { return false; } Device::setAccelerometerEnabled(tr ...

  8. R语言中数据框的横向合并与纵向合并

    #横向合并ID<-c(1,2,3,4)name<-c("Jim","Tony","Lisa","Tom")s ...

  9. Spring4定时器 cronTrigger和simpleTrigger实现方法

    spring4定时器 cronTrigger和simpleTrigger实现方法 Quartz 是个开源的作业调度框架,为在 Java 应用程序中进行作业调度提供了简单却强大的机制.Quartz 允许 ...

  10. 迅为4412开发板Linux驱动教程之GPIO的初始化

    视频下载地址:http://pan.baidu.com/s/1c06oiti GPIO的初始化 • 在内核源码目录下使用命令“ls drivers/gpio/*.o”,可以看到“gpio-exynos ...