最近在回顾之前做的wcf项目时,发现这个binding的属性有BasicHttpBinding,WSHttpBinding,webHttpBinding等几种方式。但是其中的区别当时未深入研究。现在网上查阅下,以供参考。
先附上一段英文:
(1)webHttpBinding与basicHttpBinding / wsHttpBinding的区别:
-
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
-
basicHttpBinding and wsHttpBinding are two SOAP-based bindings which is quite different from 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). 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, e.g. the WcfTestClient or your own app
(2)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
-
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, you can use streaming for large data - 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
注:未找到原文出处,故未附链接。
国内百度的这段话都是copy来,copy去的。未找到原创,***找到下面一篇文章;以待考证。
BasicHttpBinding vs wsHttpBinding vs WebHttpBinding
在园子里看到另一篇文章:
WCF中常用的binding方式
不过此文未涉及到webHttpBinding。下面赋来自msdn的解释
WebHttpBinding 类
一个绑定,可用于为通过 HTTP 请求(而不是 SOAP 消息)公开的 Windows Communication Foundation (WCF) Web 服务配置终结点。
和刚开始的英文描述吻合。