Internet Information Services 6.0
In IIS 6.0 running on Windows Server 2003, web.config files are only used by ASP.NET web applications. Therefore, it is recommended to back up the entire hierarchy of your config files from all of the websites, virtual directories, and web applications within IIS. In the IIS Manager, right-click and open the website, directory, or application and go to the physical folder where it's web.config file is located. Each website/directory/application will have a maximum of one web.config file. Make sure to back up the config files and ensure their order is intact while backing up.
The following image shows an example of a site/directory hierarchy and where the configuration files would be located:
In the above scenario, the root of the Default Web Site may have its own web.config file. Application1 under the Default Web Site may also have its own web.config file, and so on. It is a good practice to backup the metabase.xml file (for IIS related configuration settings) and all the Web.config files for ASP.NET applications on a regular basis.
Internet Information Services 7.0 and above
Beginning in IIS 7.0, both ASP.NET configuration and IIS configuration can be stored in the same web.config files. The settings pertaining to ASP.NET will be located under the <system.web> section, and IIS settings will be located under <system.webserver>.
The main IIS configuration file, applicationHost.config, is stored under the %systemroot%\Windows\System32\inetsrv\config folder. The web.config files for specific web sites, directories, and applications contain settings for both IIS and ASP.NET and are located in the root of each.
You can run the following command to take a backup of the IIS configuration file using the following command:
%systemroot%\system32\inetsrv\APPCMD add backup MyBackup
For more information on how to use appcmd.exe, please see the following link:
For web.config files, you can use the Configuration Editor (http://www.iis.net/download/administrationpack) to find where all of the web.config files are located as shown below, and accordingly make a backup for all of them.
Article ID: 2434810 - Last Review: Nov 24, 2010 - Revision: 1