http://*:80 和 http://+:80 有什么区别

发布于 2024-10-10 07:58:59 字数 163 浏览 0 评论 0原文

在了解 Web 部署 时,我遇到了一些 netsh.exe 命令,这些命令谈论 http://+:80 和 http://*:80。这些是什么意思?

In learning about Web Deploy I came across some netsh.exe commands that talk about http://+:80 and http://*:80. What do those mean?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

网名女生简单气质 2024-10-17 07:58:59

引用自 URLPrefix 字符串 (Windows) :

当 UrlPrefix 的主机元素由单个加号 (+) 组成时,UrlPrefix 会匹配其方案、端口和relativeURI 元素上下文中的所有可能的主机名,并属于强通配符类别。

当星号 (*) 作为宿主元素出现时,则 UrlPrefix 属于弱通配符类别。此类 UrlPrefix 与尚未与强通配符、显式或 IP 绑定的弱通配符 UrlPrefix 匹配的与指定方案、端口和relativeURI 关联的任何主机名相匹配。
在某些情况下,此主机规范可以用作默认的包罗万象,或者可以用于指定大部分 URL 命名空间,而无需使用许多 UrlPrefix。

之后的 :80 显示您访问与通配符字符串匹配的 URL 的端口。 80 是访问普通网页最常用(如果不是最常用)的端口之一。

As quoted from URLPrefix Strings (Windows):

When the host element of a UrlPrefix consists of a single plus sign (+), the UrlPrefix matches all possible host names in the context of its scheme, port and relativeURI elements, and falls into the strong wildcard category.

When an asterisk (*) appears as the host element, then the UrlPrefix falls into the weak wildcard category. This kind of UrlPrefix matches any host name associated with the specified scheme, port and relativeURI that has not already been matched by a strong-wildcard, explicit, or IP-bound weak-wildcard UrlPrefix.
This host specification can be used as a default catch-all in some circumstances, or can be used to specify a large section of URL namespace without having to use many UrlPrefixes.

The :80 afterwards shows the port through which you're accessing the URL matched by the wildcard string. 80 is one of the most (if not the most) common port used to access normal webpages.

素衣风尘叹 2024-10-17 07:58:59

简而言之,如果没有其他处理程序处理请求,"*" 就会处理请求,而 "+" 也会处理请求,即使请求已由任何其他处理程序处理。

一个很好的例子来自 https://stackoverflow.com/a/9459679/6375269

http://*:8080/:接收端口8080上所有非HTTP请求
已经被其他一些 HttpListener 处理。

http://+:8080/:接收端口 8080 上的所有 HTTP 请求,即使它们是
已由另一个 HttpListener 处理。

In a few basic words, "*" handles requests if no one else did and "+" handles requests even if it was handled by any other handler.

A good example taken from https://stackoverflow.com/a/9459679/6375269

http://*:8080/: Receive all HTTP requests on port 8080 that are not
already being handled by some other HttpListener.

http://+:8080/: Receive all HTTP requests on port 8080 even if they're
already handled by another HttpListener.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文