Adding a Web Site

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".

See Also:

Using Web Site Creation Wizard with IIS 6

  1. In IIS Manager, expand the local computer, right-click the Web Sites directory, point to New, and click Web Site.
    Show me.

  2. Click Next. In the Description box, enter the name of the Web site.
    Show me.

  3. Click Next. In the Enter the IP address to use for this Web site box, click All Unassigned to allow HTTP to respond to all unassigned IP addresses on the server, or click a specific IP address for the site.
    Show me.

    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.

  4. 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, use the TCP port this Web site should use box, and type a new port number above 1023.
  5. In the Host Header for this Web site (Default:None) box, type a host header name to identify a 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.
  6. If SSL encryption is enabled on the server, the SSL port box appears. Type the SSL port number, and then click Next.
  7. In the Path box, type or browse to the path of your Web site home directory.

    Show me.

  8. Web sites are configured for anonymous access by default. To create a secure or private Web site, clear the Allow anonymous access to this Web site check box, and click Next.
    Show me.

  9. In the Web Site Access Permissions dialog box, select the permissions for the home directory. Click Next, and then click Finish.

Adding a Web Site with the iisweb.vbs Command-Line Script in IIS 6

If the new Web site will be in a new directory, create the new directory. Follow these steps to do that.

  1. From the Start menu, click Run.
  2. In the Open box, type cmd, and click OK.
  3. From the command prompt, switch to the systemroot\system32 directory.
  4. Type cscript iisweb.vbs /create Home DirectorySite Description" /i IP Address /b Port and press <Enter>.

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.

Using Web Site Creation Wizard with IIS 7

  1. In IIS Manager, expand the local computer, right-click the Sites directory, and click Add Web Site.
    Show me.

  2. Click Next. The following dialog appears.
    Show me.

  3. Complete the screen using the following table.
    FieldDescription
    Site NameEnter the Web site name.
    Application Pool

    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.

    Physical path

    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.

    TypeSelect the protocol for the Web site from the Type list.
    IP Address

    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.

    Port

    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 nameOptionally, 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 immediatelyCheck this box if you do not have to make any changes to the site and want it to be immediately available.

Adding a Web Site with a Command Line Script in IIS 7

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.

Previous TopicNext Topic|