是与WCF和其他Web服务的区别? [英] what is difference with WCF and other web services?

查看:119
本文介绍了是与WCF和其他Web服务的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑与WCF和其他网络服务(如asp.net ASMX,.NET远程),有谁能够告诉我,是有什么区别与WCF和其他人,当我应该使用它,谢谢!

推荐答案

WCF是一种通信协议栈,它允许通过HTTP(如ASMX)和TCP(如远程)以及命名管道(暴露服务,这是一个真正的内机交叉过程调用),MSMQ和.NET 3.5 REST。

WCF is a communication stack that allows services to be exposed over HTTP (like ASMX) and TCP (like Remoting) as well as Named Pipes (which is really an intra-machine cross process call), MSMQ and with .NET 3.5 REST.

它允许这一点,因为它的解耦服务的通信电子部件从业务逻辑了。所有你需要做的是装饰你的服务类,方法和DTO与相应的合同属性([SeriviceContract],[OperationContract的]和[DataContract] respectivly。)

It allows this because it's decoupled the communcation parts of the service away from the business logic. All you need to do is decorate your service classes, methods and DTO's with the appropriate contract attribute ([SeriviceContract], [OperationContract] and [DataContract] respectivly.)

这已经是能够编写一次服务,并允许许多不同类型的客户端消耗相同的服务效益(即Java客户端可以使用HTTP,.NET客户端可以使用TCP,遗留可以使用MSMQ等。 )。

This had the benefit of being able to write a service once, and allowing many different kinds of clients to consume the same service (i.e. Java clients can use HTTP, .NET clients can use TCP, legacy can use MSMQ, etc.).

WCF将仍然允许你使用每个运输,包括安全,事务,可靠消息等的所有功能,但你需要使用一些照顾。并非所有的功能在所有运输工作,并需要相应地设计。 WCF允许你在你的合同所需要的功能指定。这prevents从试图在不支持所需的功能集的方式暴露你的服务Somone的(也就是说,如果您的服务要求交易,WCF运行时不会允许通过基本的HTTP端点访问的服务)。

WCF will still allow you do use all the features of each transport, including security, transactions, reliable messaging, etc., but you need to use some care. Not all features work on all transports, and you need to design accordingly. WCF allows you to specify in your contract which features are required. This prevents somone from trying to expose your service in a way that does not support the required feature set (i.e. if your service requires transactions, the WCF runtime will not allow the service to be accessed via a basic HTTP endpoint).

WCF也是可扩展通过自定义行为(这影响WCF运行时的工作方式)和专用频道(控制如何WCF服务,与外界沟通。)

WCF is also extensible via custom behaviors (which influence how the WCF runtime works) and custom channels (which control how WCF services communicate with the outside world.)

WCF有一点比较ASMX一个学习曲线,但好处是绝对出重本的学习曲线。

WCF has a bit of a learning curve compared to ASMX, but the benefits ABSOLUTLY out weight this learning curve.

希望有所帮助。

这篇关于是与WCF和其他Web服务的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆