R – How extend a website on same url but different port using stsadm

sharepoint

I'm trying to automate a sharepoint deployment and one of the tasks is to extend the web application using the stsadm command extendvsinwebfarm. However I'm constantly getting the error:

The IIS Web Site you have selected is
in use by SharePoint. You must select
ano ther port or hostname.

I think the problem is because I'm trying to extend web application using the same url. For example my cms site is:

http://myserver:8083

and i want my extended site to be:

http://myserver:80

Is it possible extend the web application using the same url via stsadm?

Best Answer

Yes, but the URL you pass into extendvsinwebfarm should have the port on it.

Using reflector it seems the Run method of the SPExtendVsInWebFarm class calls this: SPVirtualServer server = globalAdmin.ExtendVirtualServerInWebFarm(uri, virtualServerName, userTypedIn, appPoolId, bConfigurableAppPoolAccount, appPoolUserName, appPoolPassword, bAllowAnonymous, flag4);

The Uri that is passes has it's port extracted and that port is used to set up the web app.

Just tested this on our junk farm and so long as your url is in the form http://stuff:portnum then it all works.