zura
Posts: 14
Joined: Tue Aug 19, 2014 10:19 pm

Problem identifying used port for IIS site

Hi,
I'm having problem with determining that a port is already used in IIS and was wandering if someone can point me to the right direction.
My setup:
I have IIS (7.5) and two sites present - oldsite1 on port 80, and oldsite2 on 8080.
In my installer I deploy two websites newsite1 and newsite2, one on port 80 and another on 8080.
I'm using GetFreeTCPPort custom action (two of them) for each site to find a free port. They start search from 80, and 8080 respectively:
execute custom action (getfreetcpport)
set site1_port property
execute custom action (getfreetcpport1)
set site2_port property

However I get strange results, newsite1 gets deployed on port 81 (or if I 81,82 etc taken will get the next available correctly), but the newsite2 always takes 8080. Am I doing something wrong? is it because I'm running two copies of the same action and perhaps return codes (freeport status or something) get mixed up?

Thanks,
Zurab
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem identifying used port for IIS site

Hello Zurab and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

I've tested the scenario, but I cannot replicate the behavior. Can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

Also, in order to check your target machine TCP ports status you can manually run (e.g. from a command prompt window) the following command:

Code: Select all

netstat -a
So, can you please use the above command to make sure the "8080" port is indeed LISTENING when you run the setup package?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
zura
Posts: 14
Joined: Tue Aug 19, 2014 10:19 pm

Re: Problem identifying used port for IIS site

Dear Daniel,

Thank you for your replay. I collected the log and decided to look at it myself before sending and found the source of problem - this is simply a mistake of mine, all custom actions were correctly executed and properties changed but in the iis settings I was using hard-coded port :$, I guess I forgot to change everywhere when switched to finding ports dynamically. So now everything works as expected!
Zurab
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem identifying used port for IIS site

You're welcome Zurab. I'm glad you sorted things out.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
zura
Posts: 14
Joined: Tue Aug 19, 2014 10:19 pm

Re: Problem identifying used port for IIS site

Hi Daniel,

I have a somewhat related issue and was wandering if you could provide any advice: I was trying to install a web app on a specific port and although nothing was listening to it and GetFreeTCPPort was telling me it was available, after installation app pool wouldn't start and give me 503 service unavailable error. After long search online I found the root cause of it, that port was taken through url reservation (netsh http add urlacl ...). Is there a known 'ready' way to detect this in AI?
Thanks,
Zurab
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Problem identifying used port for IIS site

Hi Zurab,

There is no predefined way to detect URL reservation in Advanced Installer but you can add a Launch file custom action which uses netsh instead.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
zura
Posts: 14
Joined: Tue Aug 19, 2014 10:19 pm

Re: Problem identifying used port for IIS site

I keep coming back to the same issue and reopening this topic but I do think that this is related:

On Windows 8, there is Skype 'modern version' installed and it does use port 80. netstat shows port as listening by process wwahost.exe but still, my custom action tells me that port 80 is available, so the installer creates site and (obviously) can't start it. Any insights why getfreetcpport can't detect this specific process that is holding the port?

Thanks,
Zurab
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem identifying used port for IIS site

Hello Zurab,

You may encounter this behavior if on your test machine are installed multiple network interface cards (therefore existing multiple IPs). In this case you should also specify the IP address on which you want to check if the port 80 is free. So, can you please set the "Host name or IP (Optional)" of your "Get a free TCP port" custom action to the IP address on which the port 80 is listening and see if the behavior still persists?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”