This article will guide you through the process of using MS Deploy to sync a single web site from IIS 7.0 to another IIS 7.0 server. To sync the entire server, using the webserver provider instead of apphostconfig="Default Web Site".
Note: It is highly recommended that you do not use the metakey provider on IIS 7.0 except for migration from IIS 6.0. Using metakey to sync between two IIS 7.0 servers may not fully gather all data due to the use of the compatibility layer. By default, MS Deploy will return an error when you attempt to use the metaKey provider on IIS 7.0.
Article Goal: To synchronize a web site from IIS 7.0 to another IIS 7.0 server. I’m running ASP.NET so I need to ensure it will work after synchronization.
Prerequisites
This article requires the following prerequisites:
• .NET Framework 2.0 SP1 or greater
• MS Deploy Beta 1
Note: If you have not already installed MS Deploy, see Installing MS Deploy.
Part 1 - View dependencies of the source
1. Get the dependencies of the web site by running the following command:
msdeploy -verb:getDependencies -source:apphostconfig="Default Web Site"
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 <dependency name="WindowsAuthentication" />.
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 or destination machine
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 – To sync the site to the source server
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. Run the following command to backup an IIS 7.0 server:
%windir%\system32\inetsrv\appcmd add backup “PreMsDeploy”
2. Run the following command on the destination server to take an archive of the server for synchronization:
msdeploy -verb:sync -source:apphostconfig="Default Web Site" -dest:archivedir=c:\site1archive
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:apphostconfig="Default Web Site" -whatif > msdeploysync.log
Note: If you don't wish to sync from an archive, you can sync using the remote service. Specify computerName with the name of your server, such as Server1. If you are not running on the default port and URL, you need to specify the full URL, such as http://Server1:8080/msdeploy. For example, change the source tosource:apphostconfig="Default Web Site",computerName=Server1
4. After verifying the output, run the same command again without the whatif flag:
msdeploy -verb:sync -source:archivedir=c:\site1archive -dest:apphostconfig="Default Web Site" > msdeploysync.log
Note: You should copy the archive to the remote machine.
Note: If you don't wish to sync from an archive, you can sync using the remote service. Specify computerName with the name of your server, such as Server1. For example, change the dest to dest:apphostconfig="Default Web Site",computerName=Server1. If you are not running on the default port and URL, you need to specify the full URL, such as http://Server1:8080/msdeploy.
You are now done synchronizing your site. To verify, test browsing to the web site on the destination server. For troubleshooting help, see Troubleshooting MS Deploy.
Summary
You have now synchronized a web site from a source IIS 7.0 server to a destination IIS 7.0 server, including viewing the dependencies, configuring the destination IIS 7.0 server and performing the synchronization.
Comments