Actions
Share

Easily Migrate your web server to a new server

There are tons of great new features in IIS7 and the list continues to grow. We identify the top reasons people refuse to upgrade to IIS 7 and show you how a new tool from Microsoft, the Web Deployment Tool, makes the process nearly seamless. It is easier than you think.
 
So why are so many people still using IIS6? The common answers we hear are:

It is too difficult to migrate

I'm not sure my application will run on IIS7

If my site is not broken then why fix it?
 
It is too difficult to migrate
Below I will show you how you can use MS Deploy to remove this once cumbersome barrier.
 
I'm not sure my application will run on IIS7
While 99% of applications will run fine on IIS7 why not create another server to test the upgrade on rather than an in place upgrade?
What better way to find out than migrate it to a test server and find out if it does?

If my site is not broken then why fix it?
Performance -With IIS7 you can expect to handle 31% more requests per second. This is without ANY code rewriting! Want proof? Check out this Performance Analysis.
 
Stability - We have been happy with the stability of IIS 6 but we have had customers report about "Metabase corruption". In IIS7 there is no longer a metabase. It has been replaced with a brand new XML-based configuration store. Most of your IIS settings are stored in a file named ApplicationHost.config, which when you take a look at it looks a lot like a Web.config file.
 
Security - Before with IIS6 you had to be an administrator to manage pretty much any part of IIS. Now with IIS7 you are able to delegate role at the granular level.
 
Secure Publishing - Natively in Windows 2008 R2 (and as a separate download for Windows 2008) IIS supports FTP over SSL. This now allows secure publishing via FTP.
 
Extendable - Rather than wait for new versions of the operating system to see upgrades, the IIS team is releasing extensions what seems like every few weeks. If there is something they have not made you can even create your own! Just a few examples that have been released "out of band" are URL Rewrite, DB Management, and Bit Rate throttling.
 
 
I know what you are thinking; Ok I am sold, so how do I do it EASILY?

Web Deployment Tool, also known as MS Deploy, is a great tool the IIS team has created to make it easier to manage, deploy, and migrate your web servers.
This can be done at a granular level where you are moving just a single application or website or thousands of them. This can include all the IIS settings, content, and even certificates. You can even create your own templates migrating specific sites, application pools, registry keys, GAC objects and a ton more. What I love most about MS Deploy is you can automate the replication or syncing of multiple servers in your datacenter. In this specific article I will show how to migrate a IIS6 server to IIS7 but you can see that is simply scraping the surface of what it can do.

Prerequisites
MS Deploy requires the following prerequisites:
• .NET Framework 2.0 SP1 or greater
• Web Deployment Tool
• IIS6 or greater
Note: Instructions for installing the Web Deployment Tool are below.

Web Deployment Tool Installation
The follow steps walk you through installing the Web Deployment Tool and what options will be available to you.
 
There are two methods for migration, offline and live.
Offline - This only requires the core Web Deployment Tool to be installed without the need for the Remote Agent Service. Offline migration creates a local copy or "snapshot" that can be archived as a backup or copied to the destination server and restored. Without installing an additional listener service this could also be viewed as a more secure method.
 
Live - Live migration allows you to connect to two servers in real time to sync the setup, configuration, and content. At a minimum this requires the Remote Agent Service to be installed on the server you will want to push to or pull from. By default this service is set to manual and would need to be started in order to run the sync. After the sync you can feel free to stop the service.
 
I am a big fan of the power of Live migration, for this reason the steps below will install the Remote Agent.

GUI Installation
1. Download the Web Deployment Tool from http://www.iis.net/extensions/WebDeploymentTool

2. Run the downloaded MSI file.

3. Select Custom installation to choose what to install.




4. Click on the remote service check box.

5. Finish the installation.

6. Start the Remote Agent service by going to Start > Run and typing services.msc. The service is listed as the Web Deployment Agent Service and you simply need to right click it and start it.
 
If you prefer to use the GUI over command line you will see these options available to you during the installation process.
Remote Agent Service - If you plan on allowing remote connection to perform operations you will want to install this feature. Communication happens over HTTP/HTTPS to only server administrators.
IIS Manager UI Module - IIS module that allows users a GUI interface to perform common deployment tasks such as Website/Application deployment and exportation. (This is an optional feature only seen during installations on IIS 7.0.)


Command line Installation
1. Download the Web Deployment Tool from http://www.iis.net/extensions/WebDeploymentTool

2. Open a command prompt on your server running as an Administrator.

3. Change directory to where you downloaded the install file

4. <Downloaded_filename> /passive ADDLOCAL=ALL LISTENURL=http://+/MSDEPLOYAGENTSERVICE/





For example WebDeploy_x86_en-US.msi /passive ADDLOCAL=ALL LISTENURL=http://+/MSDEPLOYAGENTSERVICE/

This will install the deployment service so that it listens on any IP on the server over port 80 for a specific directory, MSDeployAgentService, or For Example http://AllIps/MSDeployAgentService

This will not affect any of your other sites on the server but you do have the option to install it to a unique port or directory. To do this you would simply run:
msiexec /i <Downloaded_filename> /passive ADDLOCAL=ALL LISTENURL=http://+:8383/Foo/

5. Start the service by running the following command:
net start msdepsvc

Part 1 - Verifying dependencies on your Source Machine
1. First we need to know what the dependencies are for all the sites and applications we are going to be moving. On the server you want to migrate you need to find the dependencies by running:
c:\program files\iis\microsoft web deploy\msdeploy -verb:getDependencies -source:metakey=lm
You should see something like this:
<output>
 <dependencyInfo>
    <dependencies>
      <dependency name="FTPServer" />
      <dependency name="AnonymousAuthentication" />
      <dependency name="BasicAuthentication" />
      <dependency name="WindowsAuthentication" />
      <dependency name="ISAPIFilter" />
      <dependency name="AspNet1.1" />
      <dependency name="ASP" />
    </dependencies>
    <apppoolsInUse>
      <apppoolInUse name="DefaultAppPool" definitionIncluded="True" />
      <apppoolInUse name="Production Web Site" definitionIncluded="True" />
      <apppoolInUse name="Staging Web Site" definitionIncluded="True" />
    </apppoolsInUse>
 </dependencyInfo>
</output>

From this I can see the dependencies the old server has in this case:
FTP
Anonymous, Basic, and Windows Authentication
Isapi Filters
ASP.net
ASP
 
Also I can quickly see what AppPools are also being used.
 
2. To make the migration successful you will need to install the roles you discovered from step 1 on the destination server.
 
 
There are two methods for migration, offline and live.
Offline - This only requires the core Web Deployment Tool to be installed without the need for the Remote Agent Service. Offline migration creates a local copy or "snapshot" that can be archived as a backup or copied to the destination server and restored. Without installing an additional listener service this could also be viewed as a more secure method.
 
Live - Live migration allows you to connect to two servers in real time to sync the setup, configuration, and content. At a minimum this requires the Remote Agent Service to be installed on the server you will want to push to or pull from. By default this service is set to manual and would need to be started in order to run the sync. After the sync you can feel free to stop the service.


Part 2 – Offline Migration
1. Whenever you are making a change make sure to ALWAYS make an IIS backup of the server you are migrating to. Since we are migrating to an IIS 7 server this is as easy as: 
%windir%\system32\inetsrv\appcmd add backup “Backup”

2. Run the following command on the source server to take an archive of the server for migration:
msdeploy -verb:sync -source:metakey=lm -dest:archivedir=c:\migrate,encryptPassword=yourpassword >msdeployarchive.log

3. Copy the directory, in this case c:\migrate, to the destination server.
Xcopy c:\migrate \\Destination\c$\migrate /E /I

4. Run the following command on the destination server to run a check to verify what would happen if it executed:
msdeploy -verb:sync -source:archivedir=c:\Migrate,encryptPassword=yourpassword -dest:metakey=lm -whatif > msdeploymigrate.log

5. You can check what WOULD have happened by running:
Notepad msdeploymigrate.log

6. If there are no errors and everything looks good run it without the whatif:
msdeploy -verb:sync -source:archivedir=c:\Migrate,encryptPassword=yourpassword -dest:metakey=lm > msdeploymigrate.log
 
All the IIS setup, configuration, and content from your IIS6 server will now be setup on your IIS7 server.
 
Things to watch out for:
ISAPI Filters - Frontpage extensions and other applications may register themselves as ISAPI filters. You will need to make sure these are on the new server or removed after the migration if they are no longer needed.
Local User Anonymous Permissions - If you were using a local account on the old server obviously this user would not have permissions on this new server. You will need to either switch it to a domain user who has permissions or create a new anonymous login after the migration.


Part 3 – Live Migration
If you don't want to migrate from an archive, you can migrate using the remote service we installed. In previous instructions we installed and started the Web Deployment Agent (MSDEPSVC) but you really only need to install the service on either the source or the destination depending on whether you are pushing or pulling the information.

If you want to do a "push" migration:
1. The following command needs to be run from the local server to a remote server (IIS7 is my remote server):
msdeploy -verb:sync -source:metakey=lm -dest:metakey=lm,computername=IIS7 -whatif > msdeploysync.log

2. You can check what WOULD have happened by running:
Notepad msdeploymigrate.log

3. If there are no errors and everything looks good run it without the whatif:
msdeploy -verb:sync -source:metakey=lm -dest:metakey=lm,computername=IIS7 > msdeploysync.log
 
If you prefer a "pull" migration:
1. The following command needs to be run from your destination server (IIS6 is my remote server):
msdeploy -verb:sync -source:metakey=lm,computername=IIS6 -dest:metakey=lm -whatif > msdeploysync.log

2. You can check what WOULD have happened by running:
Notepad msdeploymigrate.log
 
3. If there are no errors and everything looks good run it without the whatif:
msdeploy -verb:sync -source:metakey=lm,computername=IIS6 -dest:metakey=lm > msdeploysync.log
 
All the IIS setup, configuration, and content from your IIS6 server will now be setup on your IIS7 server.
 
Things to watch out for:
ISAPI Filters - Frontpage extensions and other applications may register themselves as ISAPI filters. You will need to make sure these are on the new server or removed after the migration if they are no longer needed.
Local User Anonymous Permissions - If you were using a local account on the old server obviously this user would not have permissions on this new server. You will need to either switch it to a domain user who has permissions or create a new anonymous login after the migration.

In this KB the steps reference moving from IIS 6 to IIS 7, but you can just as easily move from 6 to 6 or 7 to 7. The one thing you can not do is downgrade from IIS 7 to IIS 6.

Article ID: 745, Created On: 2/2/2010, Modified: 2/2/2010

Feedback (0)