IIS provides two methods for adding a new Web site.
This section explains how to compete these tasks for IIS 6 and IIS 7.
IMPORTANT: You must be a member of the Administrators group on the local computer to perform the following procedure (or procedures), or you must have been delegated the appropriate authority. As a security best practice, log on to your computer using an account that is not in the Administrators group, and then use the Run as command to run IIS Manager as an administrator. From the command prompt, type runas /user:administrative_accountname "mmc %systemroot%\system32\inetsrv\iis.msc".
NOTE: In the Web Site Creation Wizard, All Unassigned refers to IP addresses assigned to a computer but not a specific site. The default Web site uses all IP addresses not assigned to other sites. Only one site can be set to use unassigned IP addresses for a given port number. For more information on how sites are identified, see Creating Multiple FTP Sites in IIS help.
In the Path box, type or browse to the path of your Web site home directory.
If the new Web site will be in a new directory, create the new directory. Follow these steps to do that.
For example, the following command creates a Web site called MyWebSite on port 80 at IP address 123.456.789 with c:\inetpub\wwwroot\newdirectory as its home directory.
cscript iisweb.vbs /create c:\inetpub\wwwroot\newdirectory "MyWebSite" /i 123.456.789 /b 80
NOTE: The iisweb.vbs script supports additional options for creating a Web site. To see them, search for iisweb.vbs in Windows Help.
|Site Name||Enter the Web site name.|
Click Select if you want to select a different application pool than the one listed in the Application Pool box. If you do, the Select Application Pool dialog box appears. Select an application pool from the list and then click OK.
Enter the physical path to the Web site's folder. Or, click the browse button (...) to navigate the file system and find the folder.If the physical path that you enter is to a remote share, click Connect as... to specify credentials that have permission to access the path. If you do not use specific credentials, select the Application user (pass-thru authentication) option in the Connect As dialog.
|Type||Select the protocol for the Web site from the Type list.|
The default value in the IP address box is All Unassigned. If you must specify a static IP address for the Web site, type the IP address in the IP address box. All Unassigned refers to IP addresses assigned to a computer but not a specific site. The default Web site uses all IP addresses not assigned to other sites. Only one site can be set to use unassigned IP addresses for a given port number. For more information on how sites are identified, see Creating Multiple FTP Sites in IIS help.
Enter a port number. The TCP port is assigned to port 80 by default. To use a nonstandard port number to create a unique identity for a private Web site, enter a new port number above 1023.
|Host name||Optionally, enter a host header name for the Web site.If you are adding additional sites to a single IP address by using host headers, you must assign a host header name containing the full name of the site, for example, www.ektron.com.|
|Start Web site immediately||Check this box if you do not have to make any changes to the site and want it to be immediately available.|
To add a site, use the following syntax:
appcmd add site /name: string /id: uint /physicalPath: string /bindings: string
The variable name string is the name, and the variable id uint is the unsigned integer that you want to assign to the site. The variables name string and id uint are the only variables that are required when you add a site in Appcmd.exe.
NOTE: If you add a site without specifying values for the bindings and physicalPath attributes, the site will not be able to start.
The variable physicalPath string is the path of the site content in the file system.
The variable bindings string contains information that is used to access the site, and it should be in the form of protocol/IP_address:port:host_header. For example, a Web site binding is the combination of protocol, IP address, port, and host header. A binding of http/*:85: enables a Web site to listen for HTTP requests on port 85 for all IP addresses and domain names (also known as host headers or host names). On the other hand, a binding of http/*:85:marketing.contoso.com enables a Web site to listen for HTTP requests on port 85 for all IP addresses and the domain name marketing.contoso.com.
To add a Web site named contoso with an ID of 2 that has content in c:\contoso, and that listens for HTTP requests on port 85 for all IP addresses and a domain name of marketing.contoso.com, type the following at the command prompt, and then press <Enter>.
appcmd add site /name: contoso /id:2 /physicalPath: c:\contoso /bindings:http/*:85: marketing.contoso.com
For more information about Appcmd.exe, see http://technet.microsoft.com/en-us/library/cc772200%28WS.10%29.aspx.