How to stop IIS binding to all IP addresses in Windows 2008 onwards

comments

A very quick one for today – There are times when you need to run alternative services on port 80 other than IIS. In instances like this it would seem logical that it simply requires two separate IP addresses and you’re done. IIS thinks your plans are shit, and says in it’s best Soup Nazi voice “No port 80 for you!”.

image The answer lies in the fact that when IIS starts up it looks in the http.sys and checks for bindings to IP addresses – if it finds none, it defaults to binding to all unassigned IP’s. This is your problem.

Solution

As usual, the answer is simple:

You just need to tell IIS which IP addresses to listen on.

You do this as below, and you’ll need to do it against all the IP addresses you want IIS to have access to:

Open an elevated command prompt window

type the following, while replacing my x’s with the IP address you wan to use

netsh http add iplisten ipaddress=xxx.xxx.xxx.xxx

Do this for every IP address you want IIS to have access to.

Now type:

net stop http /y

This will stop the http listening service

Type:

net start w3svc

This will start all of the things you stopped in your first http call, as well as IIS.

What about Windows 2003?

In Windows 2003 you need to do this with the windows support tools and something called httpcfg.exe – instructions can be found here.