在WCF中,有几种不同类型的基于HTTP的绑定:

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.

因此,您的第一个决定必须是:REST还是SOAP(或者您可以从服务中公开这两种类型的端点——这也是可能的)。

那么,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 - 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

要了解两者之间的深入比较(包括表格和代码示例),请参阅codeproject文章:BasicHttpBinding和WsHttpBinding之间的差异

如果在将文件复制到web服务器时缺少服务名称空间引用,请尝试以下操作。我们发现,发布项目并将App_WebReference.dll文件复制到bin文件夹中可以解决这个问题。使用将服务添加到web中找到的项目中所生成的绑定。配置然后可以复制到您的服务器web。配置。