This article will guide you through the process of creating a snapshot or archive of a website, and then restoring the site from the archive.
Article Goal: Take an archive or snapshot of my web site so that I can restore or synchronize it later.
Prerequisites
This article requires the following prerequisites:
• .NET Framework 2.0 SP1 or greater
• MS Deploy Beta 1
Important note! The archive format has changed since Technical Preview 1, so archives created with that version of MS Deploy will not be compatible.
Note: If you have not already installed MS Deploy, see Installing MS Deploy.
The archive is a directory that contains the archive.xml (XML representation of config, registry objects, etc.) and also contains the actual content directories themselves. What will be automatically gathered for a site? Content, configuration and any SSL certificates.
To archive the IIS 6.0 web site
1. Run the following command on (or against) the IIS 6.0 site:
msdeploy.exe -verb:sync -source:metakey=lm/w3svc/1 -dest:archivedir=c:\archive > webdeployarchive.log
Note: To archive an IIS 7.0 web site instead, replace metakey=lm/w3svc/1 with appHostConfig=”Default Web Site”.
By specifying > webdeployarchive.log, the results of the archive will be listed in the log file and we can easily refer back to it. This archive can now be used as a backup for the site, to sync to an IIS 6.0 server or to migrate to an IIS 7.0 server.
You can create an archive with most providers, excluding directory and file path providers. You can also re-sync the source provider, like the metakey, with the same archive or create new archives to achieve versioning. However, you cannot add to an archive once it has been created.
To restore a site from an archive:
1. Run the following command on (or against) the IIS 6.0 site:
msdeploy.exe -verb:sync -source:archivedir=c:\archive -dest:metakey=lm/w3svc/1 > webdeployarchive.log
Options for archiving multiple sites or objects
If you need to archive a second directory outside the scope of your web site, or you want to include other sites or objects, you have two options:
• Archive each of them separately
• Create a manifest file to archive multiple paths
For more information about creating a manifest file, see Using Custom Manifests.
Summary
You have now synced an archive based on an IIS 6.0 web site, and restored the site from the archive. This is useful if you need to revert to a prior version of the site, or if files have become corrupt or missing from the site’s content directory.
Comments