FileRisk: Caution
config\applicationHost.config C:\Windows\System32\inetsrv\config\applicationHost.config
applicationHost.config: the root XML configuration file of IIS (sites, bindings, application pools, modules); IIS applies changes without a restart.
What it’s for
applicationHost.config is the top level of IIS 7 and later configuration. It declares sites, their bindings, application pools, modules and handlers, and most global settings. The web.config files of sites and applications only refine what it allows, after machine.config and the .NET Framework root web.config. IIS watches the file and applies any change at once, with no service restart.
What it contains
XML organized in sections, described by the config\schema folder:
<sites>: each<site>with itsid,bindingsand folder (by default%SystemDrive%\inetpub\wwwroot). Theidgives the name of theW3SVC<id>log folder.<applicationPools>: identity, CLR version, recycling.<system.applicationHost>: logging (default folder%SystemDrive%\inetpub\logs\LogFiles) and configuration history.<system.webServer>: modules, handlers, request filtering, with section locks (overrideModeDefault).
IIS automatically keeps earlier versions of this file in %SystemDrive%\inetpub\history.
Risks and best practices
- Invalid XML stops IIS from starting the service or loading sites. Change it through IIS Manager,
appcmdor PowerShell rather than by hand, and validate withappcmd list config. - Take a named backup before any significant change:
appcmd add backup, restored withappcmd restore backup. - The file can hold passwords (application pool identity, virtual directory): limit read access and do not publish it as is.
- With shared configuration, the file is read from a share: a change there is immediate for every server in the group.
Useful commands
:: Sites and their IDs%windir%\system32\inetsrv\appcmd.exe list sites
:: One specific section, as XML%windir%\system32\inetsrv\appcmd.exe list config -section:system.applicationHost/sites
:: As administrator: backup then restore%windir%\system32\inetsrv\appcmd.exe add backup "before-change"%windir%\system32\inetsrv\appcmd.exe restore backup "before-change"# Bindings and physical folders of the sitesImport-Module WebAdministrationGet-Website | Select-Object Name, Id, PhysicalPath, Bindings