Compartilhar via


Archiving and Restoring a Web Site

Applies To: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP

The ability to archive or "take a snapshot" of a Web site and then restore it or synchronize it to a new location is a useful way to streamline deployment operations and improve Web site availability. Web Deploy enables this functionality through its archiveDir provider.

This topic will briefly examine what goes into the archive, guide you through how to create a snapshot or archive of a Web site, and then show you how to use the archive to restore the Web site.

Archive Contents

The archive that Web Deploy creates is a directory destination with a name and location that you specify. The archive directory contains backups of the Web site content and application directories in readable, non-compressed format. An Archive.xml file and a SystemInfo.xml file are also saved in the archive directory. The Archive.xml file contains all of the configuration and registry information related to the Web site. The SystemInfo.xml file contains IIS-related system information that includes operating system version, Windows directory location, computer name, free drive space, IIS version, and a list of installed IIS components.

Archiving a Web Site

To archive an IIS 6.0 Web site, run the following command on (or "against") the IIS 6.0 site.

msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:archivedir=c:\archive > msdeployarchive.log

Note

If you want to archive an IIS 7 Web site (for example, the default Web site), replace the string metakey=lm/w3svc/1 with appHostConfig="Default Web Site".

Specifying >msdeployarchive.log causes the results of the archive to be output to a log file that you can easily see for analysis or troubleshooting.

In this example, metaKey is the provider specified for the -source argument, but you can also specify other providers for the -source argument when archiveDir is the -dest argument.

After you have created an archive, you can re-synchronize it with a source such as the metaKey specified in the example, or create new archives to make versioned backups. If you have to archive more than one directory, you can create a manifest file to archive multiple provider paths in a batch operation. For more information about how to create a manifest, see Creating and Synchronizing a Custom Manifest.

Restoring a Web site

To create an archive, specify the archiveDir provider for the destination (-dest) argument. To restore a Web site from an archive, specify archiveDir for the -source argument. To restore or synchronize an archived IIS 6.0 site to an IIS 6.0 server, or to synchronize it to an IIS 7 server, use the sync verb.

To restore the IIS 6.0 Web site from an archive, run the following command on (or "against") the IIS 6.0 site:

msdeploy -verb:sync -source:archivedir=c:\archive -dest:metakey=lm/w3svc/1 >msdeployarchive.log

Summary

Archived Web sites are useful if you want to revert to an earlier version of the site, or if files have become corrupt or are missing from a Web site content directory. You can archive an IIS 6.0 Web site by using the archiveDir provider as the destination, and you can restore the Web site by using the archiveDir provider as the source.

See Also

Web Deploy archiveDir Provider

Web Deploy manifest Provider

Web Deploy Providers