WCF - Versus Web Service

https://www.tutorialspoint.com/wcf/wcf_versus_web_service.htm

There are some major differences that exist between WCF and a Web service which are listed below.

这里总结了WCF和网络服务之间主要的不同之处

  • Attributes - WCF service is defined by ServiceContract and OperationContract attributes, whereas a web service is defined by WebService and WebMethod attributes.

  • Protocols - WCF supports a range of protocols, i.e., HTTP, Named Pipes, TCP, and MSMQ, whereas a web service only supports HTTP protocol.

  • Hosting Mechanisms - Various activation mechanisms are there for WCF hosting, i.e., IIS (Internet Information Service), WAS (Windows Activation Service), Self-hosting and Windows Service, but a web service is hosted only by IIS.

  • Services - WCF supports a robust security, trustworthy messaging, transaction and interoperability, while a web service only supports security services.

  • Serializer - WCF Supports DataContract serializer by employing System.Runtime.Serialization, whereas a web service supports XML serializer by making use of System.Xml.Serialization.

  • Tools - ServiceMetadata tool (svcutil.exe) is used for client generation for a WCF service, while WSDL.EXE tool is used for generating the same for a web service.

  • Exception Handling - In WCF, unhandled exceptions are handled in a better way by making use of FaultContract. They do not return to the client like in a web service as SOAP faults.

  • Has

 

1.特质:WCF服务由服务契约和操作契约定义,然而web服务是由WebService以及WebMethod属性来定义的

2.协议:WCF支持一系列的协议,例如HTTP、命名管道、消息队列,然而web服务仅仅支持HTTP协议

3.托管机制:wcf有各种可用的机制,例如IIS(互联网信息服务)、WAS(windows激活服务)、Self-hosting(自托管)以及windows服务,但是webService仅仅支持IIS

4.服务:wcf提供了一个稳健的安全,可靠的消息,事务以及互操作性。然而webService仅仅支持安全服务

5.序列化器:wCF通过使用System.Runtime.Serialization提供数据契约序列化器,然而webservice是通过使用System.Xml.Serialization来支持XML序列化器的

6.工具:svcutil.exe被客户端用来生成一个wcf服务,然而webservice使用WSDL.EXE工具

7.异常处理:在wcf中,未处理的异常会由faultContract来以一种较好的方式来处理。wcf并不会像webservice那样将未处理的异常作为soap故障返回给客户端

 

posted @ 2015-07-07 20:54  ChuckLu  阅读(201)  评论(0编辑  收藏  举报