Wednesday, May 20, 2009

IIS, WCF apps, ports, etc


I have very little experience on Web development/IIS, and it was difficult for me to understand how self hosting was working in WCF, heres what I thought :

I start my application that is hosting the service, now when i request its metadatabehaviour through my web browser, I get the wsdl, however at this time my IIS is not running and the URL is something like http://localhost:8001/service. According to me the moment I say localhost the request should go to my IIS server and from here a response should be generated, but how was this working even when IIS was stopped, that means my application was serving the wsdl response, now how can 2 applications respond to HTTP, only one can have complete control. However I soon found out that my assumptions were wrong.

Heres what really happens, when you start a website on IIS, it is typically on port 80, and when my application hosted the service I had hosted it on 8001, and hence they work independently of each other, try starting the app on port 80 and then start IIS – it throws error, so it means there can be multiple apps that can handle HTTP, just that each handles a unique set of port numbers.

No comments: