Configuring IIS 7 Site Binding with appcmd.exe
While SharePoint provides a place to configure alternate access mapping for each of the SharePoint site it does on update the bindings in the IIS configuration. In order to do this you can use appcmd.exe with the set site command.
With a large number of site binding to be configured for the different Site and server in SharePoint, for example if you have 4 web application on 4 server with 1 to 5 binding (average say 3) that would be 4 x 4 x 3 = 48 binding to be assigned to the SharePoint sites. By making use of 4 batch command files you can reduce the number of error accrues the server and there web application.
The following will add a new binding to the site
| Set appcmd =C:\Windows\System32\inetsrv\appcmd.exeSet SiteName=Default Web SiteSet IP=192.168.0.1:80Set FQDN=www.contos.com
%appcmd% set site “% SiteName%” /+bindings.[protocol='http',bindingInformation='%IP%:%FQDN%'] |
The following will remove an existing binding to the site
| Set appcmd =C:\Windows\System32\inetsrv\appcmd.exeSet SiteName=Default Web SiteSet IP=192.168.0.1:80Set FQDN=www.contos.com
%appcmd% set site “% SiteName%” /-bindings.[protocol='http',bindingInformation='%IP%:%FQDN%'] |
Using a combination of addition and removals you will be able to configure all the web application on all server the same.
References:
Binding <binding> on the IIS site.
