Page 1 of 1

Getting the TCP Port of an existing website

Posted: Fri Jan 14, 2011 10:44 am
by Justin
Hi

I am in the process of creating an installer to install an IIS website. But i need to give the user the option to install onto a New Site, Existing website or a virtual directory. After using the Get IIS Site list to get the existing sites is there any way to retrieve the TCP Port for the selected existing website?

I have so far tried the Get IIS Site Property but have been unsuccessful ("ServerBindings") :( im beginning to think that this may not be possible?

Im currently using IIS6 but would like the installer to run on IIS7 too.

Any help on this would be great.

Re: Getting the TCP Port of an existing website

Posted: Tue Jan 18, 2011 10:19 pm
by giaviv
Dear Justin,

A few issues have been discovered lately while working with IIS 6/7 in InstallAware. What I would suggest you to do as a work-around is the following:

1) Call iisweb.exe / appcmd.exe in IIS 6 and 7 (respectively) in order to query information about your website.
2) Redirect the output of these commands to a text file.
3) Read that text file and parse it to retrieve the TCP port.

I am attaching a sample project that retrieves the TCP port and supports both IIS 6 and 7, I hope it is helpful.

Best

Re: Getting the TCP Port of an existing website

Posted: Wed Jan 19, 2011 8:18 am
by Justin
Hi Giaviv

Thats brilliant, thank you so much! was very helpful indeed.

:D

Re: Getting the TCP Port of an existing website

Posted: Wed Jan 19, 2011 10:49 am
by giaviv
Dear Justin,

You are welcome! Glad to help. Please let me know if you have any more questions.

Re: Getting the TCP Port of an existing website

Posted: Mon Mar 07, 2011 7:28 pm
by mikel
Is there a way to get the TCP port (MD_SERVER_BINDINGS in metabase) for IIS5.1?

Re: Getting the TCP Port of an existing website

Posted: Tue Mar 08, 2011 4:01 am
by giaviv
Dear mikel,

I think that the MD_SERVER_BINDINGS metabase property is a complex variable - am I correct?

Re: Getting the TCP Port of an existing website

Posted: Thu Mar 10, 2011 5:33 pm
by mikel
I'm not sure if its complex or not... Maybe the more direct question I should have posted is "How do you get the TCP Port number under IIS 5.1?"

Re: Getting the TCP Port of an existing website

Posted: Fri Mar 11, 2011 11:09 am
by giaviv
Dear mikel,

If the MD_SERVER_BINDINGS doesn't work, you will have to use the example I attached above.

Re: Getting the TCP Port of an existing website

Posted: Fri Mar 11, 2011 12:06 pm
by mikel
MD_SERVER_BINDINGS does not work, and I tried the sample above, but does not work on IIS5.1

Re: Getting the TCP Port of an existing website

Posted: Fri Mar 11, 2011 2:28 pm
by giaviv
Dear mikel,

I touched up the IISGetTCPPort example to add support for IIS 5. Enjoy!

Re: Getting the TCP Port of an existing website

Posted: Fri Mar 11, 2011 3:22 pm
by mikel
Spot on Aviv!!

Re: Getting the TCP Port of an existing website

Posted: Fri Mar 11, 2011 4:38 pm
by giaviv
No worries - good luck!