It’s inevitable to migrate your websites from one server to another due to operating system upgrades. I have recently worked on migrating a website from Windows Server 2008 R2 to Windows Server 2016. You will find different ways of performing this migration by using Web Deploy.
Web Deploy is the shorter version 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.
Not happy with your IIS server’s performance but also you don’t want to migrate your sites? Here are tips to improve IIS performance: 9 Easy and Practical Recommendations to Improve IIS Performance
Migrate websites using Web Deploy (msdeploy)
msdeploy to migrate a site, check the dependencies (Reference). Based on the output of the command below, you may need to take some actions in the target server first such as creating an application pool :
msdeploy -verb:getDependencies -source:apphostconfig="Default Web Site"
1. Live sync: Try live syncing the website first. You can push the site from a source server or you can pull it from the target server (Reference). In the sample Command Prompt line 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 for a reason such as connection issues between servers or file size is over 4GB, you can use offline sync (Reference). We are basically packaging the site in one server and importing this package in the another server:
msdeploy -verb:sync -source:apphostconfig="Site1" -dest:archivedir=c:\archive msdeploy -verb:sync -source:archivedir=c:\archive -dest:appHostConfig="Site1",computerName=NewServer
3. IIS settings only: You can also sync only IIS settings by using msdeploy. 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, double check your site’s binding and test if the site is accessible.
For more features, you can use Web Deploy 4 which is installed with Visual Studio 2017 or a newer version.
You may come across “Could not reach Web Deploy” error while trying to migrate your site. Here is the solution: Could not reach the Web Deploy endpoint on the specified virtual machine