How do I run my web server (or MSMQ or whatever) over ActiveSync?

Some people have installed the CE web server or MSMQ or whatever server on their PocketPC.  (Let's assume web server for this discussion.)  They can access the web server fine from PocketIE.  If they have a network card in their device, they can access it remotely fine too.  However, if they try accessing the server via an ActiveSync connection then it does NOT work.  For instance if you plug in a USB cable to your PocketPC and your WinXP desktop and then visit /">https://<CEIpAddress>/ from your desktop Active Sync connection, nothing happens.

The reason that this is is that ActiveSync ("AS" for this discussion) blocks out all incoming ports on the CE device that come from the AS channel.  This is workaroundable with some configuration changes to your WinXP's registry.  You can add an entry to establish a well known port which will be proxy-ed back to the device.  When the device is connected via AS, AS will bind to the port, and forward connect requests to the device.

The key is:
HKEY_LOCAL_MACHINE\SOFTWARE\Mi­crosoft\Windows CE Services\ProxyPorts

The registry entries just have to be REG_DWORD, with any name you like.

This will allow you to "connect(localhost, <your port number>)", and reach the device.

Note that the client connect() MUST come from the XP device running Active Sync itself.  AS will not route requests from machines outside the network onto this box.  Also note that if you have IIS running on your local XP box, you need to turn it off so that ActiveSync can grab port 80.  You may have to restart ActiveSync and/or reboot your machine to make this change take affect.