Loading

Sunday, November 15, 2009

Synchronize IIS 6.0 Between Servers

This will guide you through the process of using the Web Deployment Tool to sync a web site from a source to a destination on IIS 6.0. You can do this by "pushing" data to a remote destination, or by "pulling" data from a remote source. This guide will show both methods, as well as an option to just use an archive folder and not install the remote service.

Ways to sync using the Web Deployment Tool
  • Push (sync from a local source to a remote destination)
  • Pull (sync from a remote source to a local destination)
  • Independent Sync (initiate a sync from a machine where both destination and source are remote)
  • Manual Local Sync (create an archive of the source and copy it to the destination, then run it locally)

Prerequisites

This guide requires the following prerequisites:
  • .NET Framework 2.0 SP1 or greater
  • Web Deployment Tool 1.0
Note: If you have not already installed the Web Deployment Tool, see Installing the Web Deployment Tool.

Part 1 - View your site's dependencies

1. Get the dependencies of the web site by running the following command:
msdeploy -verb:getDependencies -source:metakey=lm/w3svc/1
2. Review the output of the dependencies and look for any script maps or installed components in use by the site. For example, if Windows Authentication is in use by the web site, you will see .
3. If your site is inheriting any script maps, these will not be listed in the dependencies and you should also review the script maps for your site manually.
4. Compile a list of the components needed on the destination.
For detailed steps on analyzing the output of getDependencies, see Viewing Dependencies of a Web site.

Part 2 - Configure the target (destination)

1. Review the list of dependencies and install them on the destination server.
For example, let’s assume you had the following in use for your web site:
• ASP.NET
• Windows Authentication
• Anonymous Authentication
Based on analyzing your dependencies, you would install those components.

Part 3 – Sync your site to the target

1. Always make a backup of the destination and source servers. Even if you are just testing, it allows you to easily restore the state of your server.
2. Install the remote service on the source or the destination depending on if you want to "pull" the data from a remote source or "push" the data to a remote destination.
3. Start the service on the machine.
net start msdepsvc
4. Run the following command to validate what would happen if the sync were run. The whatif will not show every change, it will just show an optimistic view of what might be changed if everything succeeds (doesn't catch errors where you can't write to the destination, etc.)
Pushing to remote destination, running on source machine
msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:metakey=lm/w3svc/1,computername=Server1 -whatif > msdeploysync.log
Pulling from a remote source, running on destination machine
msdeploy -verb:sync -source:metakey=lm/w3svc/1,computername=Server1 -dest:metakey=lm/w3svc/1 -whatif > msdeploysync.log
5. After verifying the output, run the same command again without the whatif flag:
Pushing to remote destination, running on source machine
msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:metakey=lm/w3svc/1,computername=Server1 > msdeploysync.log
Pulling from a remote source, running on destination machine
msdeploy -verb:sync -source:metakey=lm/w3svc/1,computername=Server1 -dest:metakey=lm/w3svc/1 > msdeploysync.log

{Optional - Sync your site to the target using an archive}

If you don't wish to sync from an archive, you can sync using the remote service.
1. Run the following command on the destination server to take an archive of the server for synchronization:
msdeploy -verb:sync  -source:metakey=lm/w3svc/1 -dest:archivedir=c:\site1archive
2. Copy the archive folder to the destination server.
3. Run the following command on the destination server to validate what would happen if a sync was run:
msdeploy -verb:sync -source:archivedir=c:\site1archive -dest:metakey=lm/w3svc/1 -whatif > msdeploysync.log
4. After verifying the output, run the same command again without the whatif flag:
msdeploy -verb:sync -source:archivedir=c:\site1archive -dest:metakey=lm/w3svc/1 > msdeploysync.log
You are now done synchronizing your site. To verify, test browsing to the web site on the destination server. For troubleshooting help, see Troubleshooting the Web Deployment Tool.

Summary

You have now synchronized a web site from a source IIS 6.0 server to a destination IIS 6.0 server, including viewing the dependencies, configuring the destination IIS 6.0 server and performing the synchronization.

No comments:

Post a Comment