为什么我们使用 HTTP 而不是远程调用?
嘿, 首先,这是一个概念性问题,我不知道 StackOverflow 是否是合适的地方 - 所以如果我错了,我很抱歉。
如今,网络不仅用于传递原始信息。许多特别复杂的 Web 应用程序正在使用中。这些Web应用程序看起来是如此复杂,以至于使用基于如此简单的数据交换的HTTP协议似乎是不合理的,而且它是无状态的。
对此 Web 应用程序使用远程调用不是更有说服力吗?我认为最大的优点是使用 HTML 实现统一的 GUI。但有些应用程序不需要图形界面,这样 HTTP 协议就变得非常麻烦了。
Hey,
first of all this is a conceptional question and I do not know if StackOverflow is the appropriate place - so my apologies if I am wrong.
Nowadays the web is not only used for passing raw informations. Many and especially complex web applications are in use. These web application seem to be so complex that it seems irrational to use the HTTP protocol, which is based on so simple data exchange, plus it is stateless.
Would it not be more convincing to use remote invocations for this web applications? The big advantage to my mind is a unified GUI by using HTML. But there are applications, which have no need for a graphical interfaces and then it comes to a point where the HTTP protocol is really cumbersome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
简短回答:HTTP 可以通过防火墙,而其他协议将被阻止。
Short answer: HTTP is allowed through firewalls where other protocols would be blocked.
一个简短的部分答案是:首先,由于历史原因 - HTTP 自网络诞生以来就被用作请求文档的协议,并且此后被用于一些不同的目的。继续使用它的原因之一是它通常在端口 80 上提供服务,您可以确定该端口不会被客户端和服务器之间的防火墙阻止。协议的无状态性可能并不总是您想要的,但它至少具有保护服务器端免受非常琐碎的过载问题影响的优点。
A short partial answer is: first, for historical reasons - HTTP was used since the dawn of the web as protocol for requesting documents, and has since been used for some different purposes. One reason to keep using it is that it is generally served on port 80 which you can be sure won't be blocked by firewalls between your client and the server. The statelessness of the protocol may not always be what you want, but it has at least the advantage of protecting the server side from very trivial overloading problems.
现在越来越多地使用其他协议,包括远程调用和(我特别熟悉的)WCF(允许二进制 TCP/IP 数据传输)。
这使得需要更多带宽的应用程序的数据传输速度更快。例如,n 层应用程序可以在应用程序层和表示层之间使用 WCF 二进制传输。公共 Web 服务还允许多种协议,包括二进制协议。
对于数据传输协议,应该配置防火墙(即专门为您的应用程序公开一个端口),而不是解决它,我不建议使用协议,因为防火墙不会阻止它。
使用的协议实际上取决于谁将使用它以及您对消费有什么控制权 - 例如,外部第三方可能需要具有共同商定的数据接口的纯文本版本。另一方面,单个 Web 应用程序中的两层可能能够利用二进制数据传输来提高性能和安全性。
Other protocols are being used more and more now, including remote invocations and (the one I am particularly familiar with) WCF (which allows binary TCP/IP data transfer).
This allows data to travel faster for applications which require more bandwidth. For example an n-tier application may use WCF binary transfer between application and presentation tiers. Also public web services allow multiple protocols, including binary.
For data transfer protocols, firewalls should be configured (ie. expose a port specifically for your application), not worked around, I would not recommend using a protocol because firewalls do not block it.
The protocol used really depends on who will consume it and what control you have over the consumption - eg external third parties may need a plain-text version with a commonly agrreed data interface. On the other hand, two tiers in a single web application may be able to utilise binary data transfer for performance and security.