开发者

IIS7 and WCF confusion

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 ru开发者_高级运维nning 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


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜