WCF的基本httpBinding vs WSHttpBinding [英] BasichttpBinding vs WSHttpBinding of WCF
问题描述
我想用服务器数据更新客户端数据,反之亦然.目前我正在使用比 wsHttpBinding 更快的 BasicHttpBinding.我的要求是实现:
I want to update client data with server data and vice-versa. Currently i am using BasicHttpBinding which is faster than wsHttpBinding. My requirnment is to achive:
- 快速数据通信
- 安全通信
BasicHttpBinding 和 wsHttpBinding 两种绑定适合这个场景.那么我应该使用哪个绑定?和 BasicHttp 和 wsHttp 绑定有什么区别?
Two binding is suitable in this scenario BasicHttpBinding and wsHttpBinding. So which Binding should i use ? and What is the difference between BasicHttp and wsHttp binding ?
推荐答案
如果您需要安全性,请使用 wsHttpBinding
.它实现了所有各种安全功能,例如消息或传输安全、作为 Windows 凭据提供的客户端凭据、用户名/密码或证书.它支持可靠的消息传递等等 - 一系列 WS* 标准.
If you need security, use wsHttpBinding
. It implements all the various security features, like message or transport security, client credentials provided as Windows credentials, username/password, or certificate. It supports reliable messaging and a lot more - a whole slew of the WS* standards.
BasicHttpBinding
就是这样 - 非常非常基础.它或多或少是 ASMX 网络服务 - 几乎没有设置,没有安全性(除了通过 HTTPS 路由).
BasicHttpBinding
is just that - very very basic. It's more or less ASMX web services - pretty much no settings, no security (other than being routed over HTTPS).
如果您需要快速,请使用 netTcpBinding
- 但这在 Internet 连接上效果不佳.如果这不起作用,请使用 basicHttpBinding
- 它比 wsHttpBinding
更快、更精简、开销更少.
If you need fast, use netTcpBinding
- but that doesn't work well over internet connections. If that doesn't work, use basicHttpBinding
- it's faster, leaner, less overhead than wsHttpBinding
.
所以你又回到了经典的权衡:你可以选择快速或安全 - 选择一个.没有同时拥有两者的神奇"方式 - 安全性确实增加了开销,从而减慢了速度.哪个对您更重要:安全通信还是快速通信??
So you're back to the classic trade-off: you can have fast or secure - pick one. There's no "magic" way of having both at the same time - security does add overhead and thus slows things down. What is more important to you: secure communications, or fast communications??
这篇关于WCF的基本httpBinding vs WSHttpBinding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!