IIS7 和 WCF 混淆

发布于 2024-10-06 13:19:20 字数 613 浏览 0 评论 0原文

假设我正在运行一个网站(在 IIS7 上),监听端口 8000 上的请求。现在该网站仅包含静态内容(即 html 文件)。因此,当我浏览到 URL http://localhost:8000 时,浏览器会显示网站的默认 html 页面。但是,如果我还运行一个自托管 WCF 服务,侦听 URL http://localhost 上的请求:8000(此 WCF 服务不是由 IIS 托管),然后浏览器会显示有关 WCF 服务的数据:

a) 对 TCP/IP 不太了解,但据我所知,一次只有一个应用程序可以侦听特定的 IP 和端口,但是这里网站和 WCF 服务都能够侦听相同的 IP 地址和端口号。这怎么可能?

b)当我在浏览器中输入本地网址(例如 http://localhost:8000 )时,浏览器不会请求通过 IIS 访问页面?如果是这样,那么为什么它显示 WCF 服务的详细信息而不是网站的默认页面?毕竟,此 WCF 服务甚至不是由 IIS 托管的。

谢谢

Assume I’m running a website ( on IIS7 ) listening for requests on port 8000. Now this website contains only static content ( ie html files ). So when I browse to URL http://localhost:8000, browser displays website’s default html page. But if I’m also running a self-hosting WCF service listening for requests on URL http://localhost: 8000 ( this WCF service isn’t hosted by IIS ), then browser instead displays data about WCF service:

a) Don’t know much about TCP/IP, but as far as I know only one application at a time can listen on particular IP and port, but here both the website and WCF service are able to listen on the same IP address and port number. How is that possible?

b) When I enter a local url ( say http://localhost:8000 ) into browser, doesn’t browser request a page via IIS? If so, then why does it display details of a WCF service and not a website’s default page? Afterall, this WCF service isn’t even hosted by IIS.

Thank you

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

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

发布评论

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

评论(1

深爱成瘾 2024-10-13 13:19:20

确实,通常只有一个进程可以侦听特定的套接字。但是,Windows 中已经完成了专门针对 HTTP 侦听器支持此操作的工作,特别是引入了 HTTP.SYS 在 IIS 6.0 中。

基本上,内核实际上侦听 HTTP 请求,然后将连接路由到用户态中的多个侦听器进程之一。

用于自托管的 WCF HTTP 侦听器也依赖于 HTTP.sys,因此它们可以根据需要与 IIS 共享端口(或跨多个自托管 WCF 服务)。

It is true that normally, only a single process can listen on a specific socket. However, work was done in Windows to support this specifically for HTTP listeners, specifically with the introduction of HTTP.SYS in IIS 6.0.

Basically, with this it is the kernel that actually listens for the HTTP requests and then the connection is routed to one of multiple listener processes in user-land.

The WCF HTTP listeners for self-hosting rely on HTTP.sys as well, so they can share ports with IIS if needed (or across multiple self-hosted WCF services).

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