Disabling IIS6 Socket Pooling
Yesterday I ran into one of the worst features of any program ever. In an attempt to setup Subversion on Apache on Windows, I found that Apache couldn't start on the specified IP address using port 80 even though NONE of my IIS6 websites were using this particular IP address. Well, after banging my head against the wall for about an hour, I realized that even though IIS was told to use SPECIFIC addresses for each website, it felt the need to take over ALL the IP addresses on my ENTIRE system!
After a bit of research I found that this "feature" is called Socket Pooling and has been driving people nuts for a while. So, in my attempt to research how to get around this "feature", I found numerous articles online including one on TechNet describing in PARTIAL detail how to fix the problem. Not a single one of the 10+ articles I read explained how to fix this problem correctly.
Here is how you fix this "feature":
Basically you need to tell IIS6 exactly what IP addresses it is allows to use. By default it thinks it has the right to take over ALL your IP Addresses. Not sure why someone thought that was a good idea, but ok...
To tell IIS6 exactly what IP addresses you want to use, thereby freeing up all other IP address, you need the httpcfg.exe utility that comes in the Support Tools on your Windows Server 2003 disc (for R2, it's disc 1) at the follow path:
\SUPPORT\TOOLS\SUPTOOLS.MSI
In my situation, my dedicated hosting service didn't feel that I would EVER need to use ANY of the utilities installed by SUPTOOLS.MSI, so I was stuck there. Furthermore, after wasting about a half hour on searching my closets for a Windows Server 2003 trial disc, I realized that I needed a new plan. If you find yourself in a similiar situation, you can install the Windows XP SP2 Support Tools on your local machine and upload httpcfg.exe to the server. No other files are needed. The Windows XP SP2 Support Tools download is a free file downloadable from the Microsoft website.
After you have httpcfg.exe on the server, get to a command line and get httpcfg.exe in your path (I put the file in the Windows folder).
Now you need to decide what IP addresses you want IIS6 to use. This is where I kept getting confused. Because the default model of IIS6 is to greedily takeover ALL IP addresses, I kept thinking that I wanted to give IIS6 an EXCLUSION. All the articles make it sound like that. All the articles I read made it sound like that was the case. So I kept using httpcfg.exe to include an address in an exclusion list. Well, that's not how it works and the articles should have explicitily stated that. In reality, you tell IIS6 what specific IP addresses you want IIS6 to use and by doing so you are naturally disabling the "feature" of socket pooling. Moving on...
Use the following command to give IIS6 an IP address you would like for it to use (clearly 10.1.1.1 is just an example):
httpcfg set iplisten -i 10.1.1.1
Repeat that for EACH IP address you want IIS6 to use.
If you accidentally set an IP address that you didn't want to add, then you may use the following sample command:
httpcfg delete iplisten -i 10.1.1.1
If you want to see what addresses you have set, use this command:
httpcfg query iplisten
Then STOP the http service by:
net stop http /y
Then START the W3C service by:
net start w3svc
Now your IIS should be running and you should be able to start other web servers as well on different IP addresses. Now, if you find that one of your websites will NOT start and showed up as "stopped" when the other websites started fine, then the IP address for that specific site was not added via httpcfg and you need to do so for that website to start. If that website is using an IP address that Apache or something else is using, you need to choose a different IP address. It's not that big of a deal. That's what DNS was for and if you are using DNS and not just handing out IP addresses, then you won't have a problem.
As a final note, if you are on IIS5 for some reason, then, well, you should upgrade, but say you can't upgrade for some reason, then you too have this same socket pooling "feature", but it's disabled differently. I haven't tried it myself on IIS5, but according to the documenation, you can disable all IIS5 socket pooling by openning a command prompt window and moving to the \Inetpub\AdminScripts folder, then running the following command:
cscript adsutil.vbs set w3svc/disablesocketpooling true
If you see the following response, then you are good. Just stop IIS, then restart IIS and the WWW service to come back online.
disablesocketpooling : (BOOLEAN) True
This method will give you the same nice and happy message on IIS6 as well, but it's just a show intended to give you a false sense of acomplishment and doesn't actually disable socket pooling at all. This method only works for IIS5. You need to use the httpcfg.exe method described above for IIS6.