BasicHttpBinding与WsHttpBinding与WebHttpBinding

本文翻译自:BasicHttpBinding vs WsHttpBinding vs WebHttpBinding

In WCF there are several different types of HTTP based bindings: 在WCF中,有几种不同类型的基于HTTP的绑定:

What are the differences among these 3? 这3个之间有什么区别?

In particular what are the differences in terms of features / performance and compatability? 特别是在功能/性能和兼容性方面有什么区别?


#1楼

参考:https://stackoom.com/question/b7AB/BasicHttpBinding与WsHttpBinding与WebHttpBinding


#2楼

You're comparing apples to oranges here: 您在这里比较苹果和橙子:

  • webHttpBinding is the REST-style binding, where you basically just hit a URL and get back a truckload of XML or JSON from the web service webHttpBinding是REST样式的绑定,您基本上只需单击URL并从Web服务中获取大量XML或JSON

  • basicHttpBinding and wsHttpBinding are two SOAP-based bindings which is quite different from REST. basicHttpBindingwsHttpBinding是两个基于SOAP的绑定,与REST完全不同。 SOAP has the advantage of having WSDL and XSD to describe the service, its methods, and the data being passed around in great detail (REST doesn't have anything like that - yet). SOAP的优点是可以使用WSDL和XSD来详细描述服务,其方法以及要传递的数据(REST还没有类似的东西)。 On the other hand, you can't just browse to a wsHttpBinding endpoint with your browser and look at XML - you have to use a SOAP client, eg the WcfTestClient or your own app. 另一方面,您不能只使用浏览器浏览到wsHttpBinding端点并查看XML-您必须使用SOAP客户端,例如WcfTestClient或您自己的应用程序。

So your first decision must be: REST vs. SOAP (or you can expose both types of endpoints from your service - that's possible, too). 因此,您的第一个决定必须是:REST vs. SOAP(或者您也可以从服务中公开两种类型的端点-也可以)。

Then, between basicHttpBinding and wsHttpBinding, there differences are as follows: 然后,在basicHttpBinding和wsHttpBinding之间,存在以下差异:

  • basicHttpBinding is the very basic binding - SOAP 1.1, not much in terms of security, not much else in terms of features - but compatible to just about any SOAP client out there --> great for interoperability, weak on features and security basicHttpBinding是非常基本的绑定-SOAP 1.1,在安全性方面没有多大的限制,在功能方面没有太多的其他限制-但与那里的任何SOAP客户端兼容->互操作性很好,功能和安全性较弱

  • wsHttpBinding is the full-blown binding, which supports a ton of WS-* features and standards - it has lots more security features, you can use sessionful connections, you can use reliable messaging, you can use transactional control - just a lot more stuff, but wsHttpBinding is also a lot *heavier" and adds a lot of overhead to your messages as they travel across the network wsHttpBinding是成熟的绑定,它支持大量的WS- *功能和标准-它具有更多的安全性功能,可以使用会话连接,可以使用可靠的消息传递,可以使用事务控制-只是更多的东西,但wsHttpBinding也“繁重”,并且在您的消息通过网络传播时会增加大量开销

For an in-depth comparison (including a table and code examples) between the two check out this codeproject article: Differences between BasicHttpBinding and WsHttpBinding 有关两者之间的深入比较(包括表和代码示例),请查看此代码项目文章: BasicHttpBinding和WsHttpBinding之间的差异

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值