Are you looking at moving to another hosting provider, upgrading to a new Windows Server or duplicating your sites to another Windows Server?  Web Deploy is a great tool to help you accomplish this task.  If you have several sites to migrate, using Web Deploy will help eliminate the long and tedious task of manually getting these sites in place on another Windows Server.  Web Deploy can make migrating to our Windows Cloud Server or physical dedicated server a breeze. 

Before You Get Started

Web Deploy works by packaging the web applications or site’s content, configuration, databases, SSL certificates and even GA assemblies to a zip file.  You would then run Web Deploy on the destination server to import the package file to get the configuration in place on the destination server.  Web Deploy can be used to migrate web servers from IIS 6 to IIS7 and IIS 8.

As of this blog post, Web Deploy 3.0 is the latest version.  It is also the version used in the example below.  The example covers migrating between IIS 7 servers and does not include steps to migrate a database.  Also note, the steps to migrate your sites from IIS6 to IIS7 is different than what I will be covering.  You will need to install Web Deploy 3 on both servers if it is not already installed.  You can use Windows Platform Installer (WPI) to install this application. 

In order to have working sites after the migration, make sure you prepare the destination server beforehand.  Make sure the destination server has the same IIS components and applications installed as the original server.  This includes things like URL Rewrite, IIS Media Services 4.1, PHP, MySQL or even the various .NET framework versions.  If you use a custom identity user to run the application pools, y1ou will need to recreate them on the destination server.

Before beginning, you should also backup the following configuration files on both servers, administration.config and applicationHost.config.  The default location for these files are in C:\Windows\System32\inetsrv\config.  These files contain all of your site settings.  The steps in the example below will only modify these files on the destination server; however, we are being cautious by backing up the files up on both servers.  If you run into issues during the process and need to get the destination server back to its original state, just restore the backup copies of these files.  Now let’s get started with the steps to make this happen!

Export Steps:

  1. Open IIS 7.0 Manager on your server that has the sites you want to migrate
  2. Right click on the server name, select Deploy and click on Export Server Package

  Export Server Package

  1. On the Export Server Package screen select Manage Components

  Export Server Package - Manage Components

  1. In Manage Components, make sure the first provider name webServer is listed. This will allow you to export the entire server configuration.  If it is missing, you can click the cell under Provider Name and choose it from the list.

Manage Components - WebServer

  1. Click OK, then click Next twice
  2. Enter the path where you want to save the exported zip file
  3. Click Next
  4. You may be prompted to enter an encrypted password if it detects you have any secure settings
  5. Upon completion will we be presented with a summary and details of the exported package

Exported Package Progress Summary

  1. Click Finish and copy the exported file to your destination server (new server)

Import Steps:

  1. Open IIS 7.0 Manager on the destination server for the sites (server you’re migrating to)
  2. Right click on the server name, select Deploy and click on Import Server or Site Package
  3. Browse to the exported zip file you copied over and select it
  4. Click Next
  5. If you had to enter an encrypted password you will be prompted to enter the password to decrypt the file
  6. Click Next
  7. Click OK to overwrite the existing IIS configuration on the server

  Import Server or Site Package

  1. Click Next
  2. Upon completion will we be presented with a summary and details of the exported package
  3. Click Finish

To complete this in one step and directly transfer the changes to the new server, you can run the following command from the command line on the destination/new server.  Simply replace sourcemachine with the name of the original or source server.  The second command can be used to test the deployment.  The results of the test deployment will be recorded to the log file where you can review what changes will be made before you start.

msdeploy -verb:sync -source:webServer,computername=sourcemachine -dest:webServer >  c:\msdeploy.log 

 

msdeploy -verb:sync -source:webServer,computername= sourcemachine -dest:webServer -whatif > c:\msdeploy.log

If you run into issues with your site(s) not working on the destination server make sure to review the event logs for clues. In any case, feel free to ask questions or leave comments below. 

If your interested to learn more about CCMS, a service that handles tasks like this one, give us a call at 1-855-780-0955, or email us at Sales@sherweb.com.

Written by Fred Cumbee Employee @ SherWeb