If you are running your own webserver and maybe have bought a Flashcom license alongside it then you might be tempted to run both your webserver and flashcom apps on the same box. And why not, after all we don't all have multiple machines at our disposal.

The following configuration is one that I have set up several times. I am running IIS (Microsoft's Internet Information Server) and FCS (Flash Communication Server 1.5.2) on the same server which uses Windows 2000 Server as its OS.
It's possible to use other webservers like Apache for this but in this tutorial I will focus on IIS and FCS on Windows so keep that in mind if your setup is different.

The principles behind it are the same on any server: we want FCS to use other ports than the standard 1935 because we want to use http tunneling. As you might know tunneling uses port 80 (usually used for 'normal' http website traffic) or port 443 which is common for SSL traffic. Both ports are often open on firewalls hence the tunneling there ;-)

The problem is that no two services on one IP address (read: our machine) can use the same port - we would end up having FCS and IIS competing for port 80, and one service would win. Should FCS start up before IIS then it might grab port 80 and not allow any website (IIS) traffic through it, effectively making any website unavailable. that's when you would get the alert in IIS saying 'address is already in use'. Let that be your warning sign.

The whole problem is easily solved in a few steps.

Step 1 - Assign a second IP address to your server
If your server is hosted remotely simply ask your hosting provider for a second IP. Sometimes they charge for this but it's usually a $10 one off fee, that's all. Your host might ask you why you want the secondary IP, tell them you want to run 2 services on port 80.
If you are running your own server then assign a secondary IP yourself, how this is done is beyond the scope of this article. You'll find this information on the net.

Step 2 - Stop IIS grabbing all available IPs
By default IIs will bind to all IP addresses it can find. To prevent this from happening you need to disable socket pooling in IIS. This is quite easily done and you can see a full description in this article.

Addition: since this tutorial was released I have also installed FCS on Windows 2003 Server and the process of stopping IIS grabbing all IPs is different to Windows 2000. You need to use a utility called httpcfg.exe, read about it here.
The following steps apply to Windows 2000 as well as Windows 2003.

Step 3 - Bind IIS to one IP address
For example say your host has assigned the following two IP addresses to your server: 123.123.123.1 and 123.123.123.2. We decide we want to bind 123.123.123.1 to IIS.
To do this open Internet Information Services Manager (start > control panel > Administrative Tools > Internet Information Services). Right-click on the first website listed and select 'Properties'. The following panel (or similar) should pop up:


In the dropdown next to 'IP Address' you can now select one of all IP addresses available on this machine. You should select the one of the two you have available. Also add any host headers if necessary and repeat this process for every site on your server, always making sure that no site has (All Unassigned) selected. Each site should bind to the same IP address, we will later bind FCS to the other.
For information on host headers consult the Microsoft website. You should know how these work if you run your own webserver.

Step 4 - Bind FCS to the other IP address
We are almost done. IP addresses in FCS are configured via a file called Adaptor.xml. You can bind FCS to any IP or all IPs available. By default FCS tries to bind to all IPs available so we need to edit the Adaptor.xml file to change this. Adaptor.xml is inside the conf\_defaultRoot_directory. Open it for edit.
Find the <HostPort>:1935</HostPort> tag. In this case FCS binds to port 1935 on any IP address. In our example we want it to bind to 123.123.123.2 on port 1935, 80 and 443.

Therefore our host tag should look like this:
<HostPort>123.123.123.2:1935,80,443</HostPort>

Save the file, restart FCS, restart IIS and you are done. You can now run websites and FCS on the same machine with http tunneling fully functional.

I *think* that the admin port 1111 for FCS will still bind to both IPs but this won't affect IIS in any way. Also I you do not want to use tunneling then IIS and FCS live happily alongside on a single IP.