Wednesday, July 23, 2014

Migrate a Web Site from IIS 6.0 to IIS 7 or above

This quick guide will help you migrate a Web site from IIS 6.0 to IIS 7 or above by using the Web Deployment Tool.
What kinds of migrations can I accomplish with the Web Deployment Tool?
  • Migrate 1 or 1,000 Web sites from IIS 6.0 to IIS 7 or above including all the configuration settings, content and certificates
  • Migrate a single application
  • Migrate an entire server (all Web sites, application pools, etc.) from IIS 6.0 to IIS 7 or above
  • Migrate a custom manifest comprised of sites, application pools, assemblies, COM objects, registry keys, content and more from IIS 6.0 to IIS 7 or above

Prerequisites

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

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.


Part 2 - Configure the target

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 this analysis of your dependencies, you would install the corresponding components and modules.

Part 3 – Migrate your site to the target by using a package file

1. Always make a backup of the destination server. Even if you are just testing, it allows you to easily restore the state of your server.
%windir%\system32\inetsrv\appcmd add backup PreWebDeploy
2. Run the following command on the source server to create a package (compressed) file of the server:
msdeploy -verb:sync  -source:metakey=lm/w3svc/1 -dest:package=c:\Site1.zip > WebDeployPackage.log
3. Copy the package file to the destination server.
3. Run the following command on the destination server to validate what would happen if a sync operation were run:
msdeploy -verb:sync -source:package=c:\Site1.zip -dest:metakey=lm/w3svc/1 -whatif > WebDeploySync.log
4. After verifying the output, run the same command again without the whatif flag:
msdeploy -verb:sync -source:package=c:\Site1.zip -dest:metakey=lm/w3svc/1 > WebDeploySync.log

{Optional - Migrate your site to the target by using the Web Deployment Agent Service}

If you don't want to use a package, you can use the Web Deployment Agent Service (MsDepSvc, also called "remote service") to synchronize from IIS 6.0 to IIS 7 or above.
1. Install the remote service on either the source or the destination depending on whether you want to synchronize from a remote source or to a remote destination.
2. Start the service on the computer.
net start msdepsvc
3. Run the following command to do a "push" synchronization from the local source to a remote destination (replace Server1 with the name of the remote computer). Run the command first with the whatif flag, then without it once you have confirmed that the command will do what you want.
msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:metakey=lm/w3svc/1,computername=Server1 -whatif > msdeploysync.log
4. Alternatively, run the following command to do a "pull" synchronization from the remote source to the local destination (replace Server1 with the name of the remote computer). Run the command first with the whatif flag, then without it once you have confirmed that the command will do what you want.
msdeploy -verb:sync -source:metakey=lm/w3svc/1,computername=Server1 -dest:metakey=lm/w3svc/1 -whatif > msdeploysync.log 
You are now done migrating your site. To verify, test browsing to the web site on the destination server. For troubleshooting help, see Troubleshooting Web Deploy.

Summary

You have now synchronized a Web site from a source IIS 6.0 server to a destination IIS 7 or above server by viewing the dependencies, configuring the destination IIS server, and by using a package file or the Web Deployment Agent Service.

No comments:

Post a Comment