Unfortunately, you cannot get the port number, since IISNode does not use ports and instead uses streams with channels, which are the random string that you see for the port number. If you want to capture the actual HTTP port on which the IIS website is running, you need to either analyze the configuration file that stores this information, or set it as an environment variable accessible by Node itself.
Is there a reason why you need a port for your application? You do not need the port to run the application, as Node will treat this random string as a channel instead of starting the server on the port.
source share