Configuration Store

 

Applies To: Windows Server 2012 R2, Windows Server 2012

IIS 8 uses a new XML-based configuration store that is modeled after the ASP.NET configuration. IIS configuration is stored in the ApplicationHost.config file and can also be distributed among Web.config files for sites, applications, and directories. Settings configured at one level are inherited automatically by lower levels, unless they have been locked to prevent changes. By default, the server administrator is the only user who has permission to view and edit the ApplicationHost.config file.

In this document

Working with configuration files in IIS 8.0

In IIS 8, the configuration system enables you to customize web server administration by delegating configuration sections from server-level configuration files to Web.config files in your sites, applications, and virtual or physical directories.

Delegating configuration in IIS 8.0

In IIS 8, the locking and unlocking of sections in configuration is known as feature delegation, and these actions enable you to define at what level IIS reads and writes configuration. By default, all sections in configuration are locked and can be configured only in server-level configuration files except for the following sections (also referred to as features):

  • Default document

  • Directory browsing

  • HTTP protocol

  • HTTP redirect

You can unlock more configuration sections to let non-administrators view and change configuration for the unlocked sections in Web.config files for specific sites, applications, directories, or even URLs. For example, you might unlock the connectionStrings section to let non-administrators configure settings to connect their applications to databases. Alternatively, if you want only administrators to view and change configuration, you can lock all configuration sections and store settings only in server-level configuration files.

Configuration levels

In IIS 8, you can configure settings at the following levels:

  • Web server

  • Site

  • Application

  • Virtual or physical directory

  • URL (also known as file-level configuration)

Note

To configure settings at a child level, a configuration section must be unlocked (also known as delegated) at the parent level or levels. For example, to configure a feature at the application level, the related configuration section or sections must be delegated at both the server and the site levels.

Configuration files

Configuration exists in a physical directory in either server-level configuration files or in Web.config files. Every configuration file maps to a specific site, application, or virtual directory.

Server-level configuration is stored in the following configuration files:

  • Machine.config. This file is located in %windir%\Microsoft.NET\Framework\framework_version\CONFIG.

  • Root Web.config for the .NET Framework. This file is located in %windir%\Microsoft.NET\Framework\framework_version\CONFIG.

  • ApplicationHost.config. This file is located in %windir%\system32\inetsrv\config.

Site, application, and virtual and physical directory configuration can be stored in one of the following locations:

  • A server-level configuration file. When configuration for a site, application, directory, or URL is stored in a server-level configuration file, use a location tag to specify the site, application, directory, or URL to which the configuration applies.

  • A parent-level Web.config file. When configuration for an application, directory, or URL is stored in a parent-level configuration file, use a location tag to specify the child at which the configuration applies.

  • The Web.config file for the site, the application, or the directory. When you configure settings for an application, directory, or URL, the configuration is stored in the same directory as the site, application, or directory. You do not need to use location tags.

Storing configuration settings in a parent configuration file is helpful when:

  • You want to store configuration settings in a configuration file that is accessible by only certain users or groups. For example, the ApplicationHost.config file is available only to the Administrator account and to the members of the Administrators group on a specific computer, as well as to domain administrators when a computer is part of a domain.

  • You want to configure a feature at the URL-level (also known as file-level).

Inheritance

Sites, applications, virtual directories, physical directories, and files inherit configuration settings from the server-level configuration files and from any parent configuration files. For example, an application inherits configuration settings from the server-level configuration files and from the site's root application Web.config file. The following table illustrates the configuration files in which you can store an object's configuration.

Note

Configuration sections must be delegated if configuration files other than server-level configuration files are used.

Configuration Object

Server-Level Configuration Files

Parent-Level Configuration Files

Other Configuration Files

Comments

Web server

Machine.config

Root Web.config

ApplicationHost.config

Not applicable

Not applicable

No location tags are needed. Server-level configuration can only exist in server-level configuration files.

Site

Machine.config

Root Web.config

ApplicationHost.config

Not applicable

Site's root application Web.config

Use location tags to store site configuration in server-level configuration files.

Application

Machine.config

Root Web.config

ApplicationHost.config

Site's root application Web.config

Application's Web.config

Use location tags to store application configuration in server-level configuration files or a parent configuration file.

Virtual or Physical Directory

Machine.config

Root Web.config

ApplicationHost.config

Parent site's root application Web.config

Parent application's Web.config

Directory's Web.config file

Use location tags to store directory configuration in server-level configuration files, or in a parent configuration file.

URL (or file)

Machine.config

Root Web.config

ApplicationHost.config

Parent site's root application Web.config

Parent application's Web.config

Parent directory's Web.config

Not applicable

Use location tags to store URL-specific configuration in server-level and parent-level configuration files.

Copy configuration files to a remote server

IIS 8 uses XML files to specify web server, site, and application configuration settings. The primary configuration file for IIS 8 is ApplicationHost.config. IIS 8 also uses Web.config files for applications or directories. These files can be copied from one web server or site to another to apply the same settings to multiple objects.

Requirements

Levels

This procedure can be performed at the following levels in IIS:

  • Web server

  • Site

  • Application

  • Physical and virtual directories

Required Permissions

To perform this procedure, you must be a server administrator or you must have write access to the target location.

To copy and deploy a configuration file

You can perform this procedure by running xcopy commands in a command-line window.

Copy configuration to another location on the same computer

To locate help information about xcopy, type the following at the command prompt, and then press ENTER:

xcopy /?

To copy configuration folders and files to another location on the same computer, use the following syntax:

xcopy source** **destination /E

The variable source is the location from which you are copying the folders and files, and the variable destination is the location to which you are copying the folders and files. The parameter /E specifies that all the contents of the source location be copied to the destination location.

For example, to copy the IIS configuration folder and all its contents from the system root to another path on your local computer, type the following at the command prompt, and then press ENTER:

xcopy %windir%\system32\inetsrv\config c:\config /E

Copy configuration from one computer to another computer

To copy a source from your local computer to another computer, use the net use command to connect to the computer, and then use the xcopy command to copy the folder and files. To locate help about net use, type the following at the command prompt, and then press ENTER:

net use /?

For example, to copy the IIS configuration folder and all its contents from the system root to another computer, use the following syntax:

**net use \\computername\**drive *** /USER:domain\**username

The variable computername is the name of the computer to which you are connecting, and the variable drive is the drive to which you want to connect. The parameter * prompts you for a password to connect to the computer and drive after you run the command. The variable domain is the domain to which the user belongs, and the variable username is the user name of the user who is connecting to the computer.

Once you connect to the computer to which you want to copy files, you can use the xcopy syntax as specified in the previous section. For example, to connect to another computer and copy all the IIS configuration folders and files from the system root on your local computer to the other computer, type each of the following commands at the command prompt, and then press ENTER:

net use \\contoso\c$ * /USER:SALES\joseph

xcopy %windir%\system32\inetsrv\config \\contoso\c$\config /E

After you are finished copying folders and files to the remote computer, close the connection. To do this type the following at the command prompt, and then press ENTER:
net use \\contoso\c$ /delete

See Also

IIS Manager UI (IIS 8)