How to migrate a website using Web Deploy
You may want to migrate your websites between IIS servers when you need an OS upgrade.
In many cases, migration is easier than building a site from scratch.
You can use the Web Deploy tool to migrate websites. Web Deploy is the shorter name for
Web Deployment Tool. You can download this tool by using Web Platform Installer (More
Information). We leverage this tool by calling msdeploy in the Command Prompt.
There are different ways of performing this migration by using Web Deploy. However, before
starting the migration, check the dependencies first (Reference). Run the command below.
Based on the output, you may need to take some actions such as installing certain server
features or creating an application pool.
msdeploy -verb:getDependencies -source:apphostconfig="Default Web Site"
Alternative ways of using Web Deploy for migration
1. Live sync: Try live sync first. This can be done by pushing the site from a source
server or pulling it from the target server (Reference). In the sample command below,
we are pushing/syncing the site from the server in which we run this command to the
Server1:
msdeploy -verb:sync -source:apphostconfig="Default Web Site"
-dest:apphostconfig="Default Web Site",computername=Server1
2. Offline sync: If live sync fails (connection issues are the most common reasons) or if
the file size is over 4GB, use offline sync (Reference). With offline sync, we are
basically packaging the site in one server and unpacking it in another server.
Export:
msdeploy -verb:sync -source:apphostconfig="Site1"
-dest:archivedir=c:\archive\package.zip
Import:
msdeploy -verb:sync -source:archivedir=c:\archive\package.zip
-dest:appHostConfig="Site1"
3. IIS settings only: You can also sync only IIS settings. In this case, you will need to
copy the content manually.
msdeploy -verb:sync -source:webserver60 -dest:package=c:\somepackage
-disableLink:Content
After the migration is completed, check your site’s bindings. Test if the site is accessible.