How to migrate a website using Web Deploy
Published Sep 12 2019 08:02 AM 18.1K Views
Microsoft

You may want to migrate your websites between IIS servers when you need OS upgrade. In many cases, migration is easier than building a site from scratch.

 

You can use Web Deploy tool to migrate websites. Web Deploy is the shorter name for Web Deployment Tool. You can get this tool by using Web Platform Installer (More Information) or you can download and install the standalone exe file (Link). We leverage this tool by calling msdeploy in the Command Prompt.

 

3.jpg

 

There are different ways of performing this migration by using Web Deploy. However, before staring the migration, check the dependencies first. 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. 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

 

 

 

  1. Offline sync: If live sync fails (connection issues are the most common reasons) or if the file size is over 4GB, use offline sync. 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"

 

 

  1. 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:webserver -dest:package=c:\folder\package.zip -disableLink:Content

 

 

Once you create a package, you can import it by using Import link in IIS Manager (This link shows up only if you install Management Service through Server Manager and IIS Deployment Handler through Web Deploy installation).

 

After the migration is completed, check your site’s bindings. Test if the site is accessible.

 

In order to import a site package, you will need to create the application pool (and app pool identity) in the destination server manually. Once there is an application pool, Web Deploy can create the site and site folder automatically. You don’t need to make changes to applicationHost.config manually. Web Deploy will add site/folder information automatically.

 

If you try to import a site package without creating the app pool first, it will give this error:

 

Error: The AppPoolNotFound dependency check found the AppPool 'testsite2' to be in use by the source data but not defined in source data or on the destination computer.  Applications referencing this application pool will have configuration issues.

 

If you import a server package, Web Deploy creates everything including application pools, sites, and folders.

 

Additionally, in order to do a smooth migration, please make sure all IIS modules (features under Web Server in Server Manager) that are installed in the source server are installed in the destination server as well.

 

 

Co-Authors
Version history
Last update:
‎Nov 11 2021 01:45 PM
Updated by: