Packaging and Restoring a Web site

by Faith A

This quick guide will show you how to create an package (compressed file) of a Web site, and then restore the site from the package.

Prerequisites

This guide requires the following prerequisites:

  • .NET Framework 2.0 SP1 or greater
  • Web Deployment Tool 1.1

Note: If you have not already installed the Web Deployment Tool, see Installing Web Deploy.

To package and restore an IIS 6.0 Web site

  1. To create a package, run the following command:

    msdeploy.exe -verb:sync -source:metakey=lm/w3svc/1 -dest:package=c:\dws.zip > DWSpackage6.log
    
  2. To restore the package, run the following command:

    msdeploy.exe -verb:sync -source:package=c:\dws.zip -dest:metakey=lm/w3svc/1 > DWSpackage6.log
    

To package and restore an IIS 7 or Above Web site

  1. To create a package, run the following command:

    msdeploy.exe -verb:sync -source:apphostconfig="Default Web Site" -dest:package=c:\dws.zip > DWSpackage7.log
    
  2. To restore the package, run the following command:

    msdeploy.exe -verb:sync -source:package=c:\dws.zip -dest:apphostconfig="Default Web Site" > DWSpackage7.log
    

Options for packaging multiple sites or objects

If you need to package a second directory outside the scope of your Web site, or you want to include other sites or objects, you have two options:

  • Package each of them separately
  • Create a manifest file to package multiple paths (see Using Custom Manifests)

Summary

You have now created a package of a Web site, and restored the site from the package. 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.