You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
User Interface
To use the UI
- Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
- In the Connections pane, expand the Sites node in the tree, and then select the site for which you want to configure a host header.
- In the Actions pane, click Bindings.
- In the Site Bindings dialog box, select the binding for which you want to add a host header and then click Edit or click Add to add a new binding with a host header.
- In the Host name box, type a host header for the site, such as www.contoso.com.
- Click OK.
- To add an additional host header, create a new binding with the same IP address and port, and the new host header. Repeat for each host header that you want to use this IP address and port.
Command Line
To add a host header to a Web site's binding, use the following syntax:
appcmd set site /site.name: string /bindings.[protocol=' string ',bindingInformation=' string '].bindingInformation: string
The variable site.name string is name of the site to which you want to add a host header. The variable [protocol='string',bindingInformation='string'] is the existing binding to which you want to add a host header, and bindingInformation string is the new binding with host header.
For example, to configure a site named contoso with an existing HTTPS binding for all IP addresses, on port 443, without a host header to have a host header named marketing, type the following at the command prompt, and then press ENTER:
appcmd set site /site.name: contoso /bindings.[protocol='https',bindingInformation='*:443:'].bindingInformation:*:443: marketing
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
appcmd set site /site.name: string /bindings.[protocol=' string ',bindingInformation=' string '].bindingInformation: string
The variable site.name string is name of the site to which you want to add a host header. The variable [protocol='string',bindingInformation='string'] is the existing binding to which you want to add a host header, and bindingInformation string is the new binding with host header.
For example, to configure a site named contoso with an existing HTTPS binding for all IP addresses, on port 443, without a host header to have a host header named marketing, type the following at the command prompt, and then press ENTER:
appcmd set site /site.name: contoso /bindings.[protocol='https',bindingInformation='*:443:'].bindingInformation:*:443: marketing
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
Configuration
The procedure in this topic affects the following configuration elements:
<bindings> under <site> element
<bindings> under <site> element
No comments:
Post a Comment