Saturday, September 20, 2008

Figuring out if a Port number is already used before creating a MOSS site.

I was having trouble creating my MOSS SSP for the MySites and Personal Sites. Every time I started with a New SSP and went ahead with the creation of a new web application, I received this error "Port already in use. Try creating at a different port.......".
I know this could be very simple for someone who has a limited number of site in IIS. You could very easily go to IIS, right click on each of the web sites and figure out if the port number in question has already been consumed. But for me, I had almost 35 sites and I really did not want to be going with this approach. So I figured this out. Hope this would be help to anyone getting this error.
There is a command line utility, which gives you the list of all the existing port in IIS which are actually geared for listening.
What that means is, they have already been used to setup a site on those ports.
That said, you must not use them again, unless you are trying to extend a site on the same port, of course.
So follow these steps, to verify which ports are listening :

#1 Open the Command Prompt window.
#2 At the command prompt, type netstat -n -a.
Here, the -n switch is used to numerically display the address and port number of active TCP connections. The -a switch is used to display the TCP ports on which the computer is listening.

HTH.
Thanks.