This article describes how to create the backup of IIS Web site, application pool and configuraion and restore them on another server. This guide will help you to create your own plan of emergency recovery for IIS-based websites, migrate the configuration and websites between the servers or add a new server to the web farm.
Backup of website data and configuration running on the Internet Information Service web server consists of several steps:
- Backup of website files (by default, they are stored in %SystemDrive%\inetpub\wwwroot). This directory must be included to the backup plan to create its copy using backup tools or your own scripts
- Backup (export) of current IIS certificates (you can get the list of SSL certificates on the server using this command: netsh http show sslcert)
- Backup of IIS configuration (settings)
We’ll show how to create a backup of IIS configuration on one server and restore it on another one.
Using appcmd, create IIS configuration backup on first server. To do it, run the command prompt with the administrator privileges and go to the following directory:
cd c:\Windows\system32\inetsrv
Create the IIS configuration backup with name srviis1-backup-20161107:
appcmd add backup srviis1-backup-20161107
After the command has been executed, a folder with your backup name appears in c:\Windows\system32\inetsrv\backup. Here is its contents for my simple website:
- administration.config
- applicationHost.config
- MBSchema.xml
- MetaBase.xml
- redirection.config
Copy the backup folder to the same directory c:\windows\system32\backup on another server.
To display the list of all available backups, run the following command:
appcmd list backup
As we can see, the backup we have copied has appeared in the list of available backups.
Recover IIS configuration from this backup:
appcmd restore backup srviis1-backup-20161107
The string Restored configuration from backup “srviis1-backup-20161107″ means that IIS configuration has been successfully recovered.
The list of restrictions and important issues.
- The same IIS version has to be used on both servers
- If any application pool is run not from the integrated accounts, they have to be available on another server as well
- Before recovery, you should export and migrate all current certificates to the new server
1 comment
Thank you for writing this. Depending on user needs for ongoing IIS and SQL Server configuration remediation, rollback, backup and recovery, a commercial solution like Orcaconfig may make sense.
Orca takes configuration inventory snapshots (every few minutes or so) and stores the current configurations of the Production environment. In a recovery or disaster scenario where you lose access to Production and need to fail over to DR, your Production configuration settings already stored automatically.