IIS Hacks: Server Resources

Below are the steps required to move a website hosted on IIS6 to IIS7 (Internet Information Services 6 to 7). IIS7 replaces the aging metabase with a more convenient applicationHost.config which stores the configuration in XML.

There are two versions of MS Deploy, the program needed to migrate. Download the 32bit version here, and the x64 version here.

Installing MS Deploy on the Source IIS6 Server

  1. You must have .NET Framework 2.0 SP1 or 3.5 installed on the server.
  2. Download the file and open it. Choose Setup Type: Typical. Be sure to use the x64 version if you have Windows 2003 x64. There is no entry in the Start Menu; you need to start the program through the command prompt. C:\Program Files\Microsoft Web Deploy\msdeploy followed by the command.

Installing MS Deploy on the Destination IIS7 Server

  1. Same as above. Be sure to use the x64 version if you have Windows 2008 x64.

Create a Backup of the IIS7 configuration

It is important to create a backup of the IIS7 configuration before you start. You never know when you’ll make a mistake, and restoring IIS to the default configuration without a backup isn’t fun.

IIS7 comes with the appcmd.exe command line tool, which is new for IIS7, and simplifies configuration backups immensely. It is located in the %windir%\system32\inetsrv\ folder, which isn’t in the path variables, so you’ll need to navigate to that path with the command prompt first.

  1. Click Start -> Run -> type “cmd” and press OK.
  2. At the command prompt, navigate to the %windir%\system32\inetsrv\ folder. (type “cd \” and then “cd C:\Windows\system32\inetsrv” if windows is in the default path)
  3. Once in the target directory, type: appcmd add backup “BackupPreMigrate”
  4. Press Enter. All done.
  5. To display a list of previous backups type: appcmd list backup
  6. To restore a backup, type: appcmd restore backup “BackupPreMigrate”

Verify Dependencies on Source IIS6 Server

Below is a screenshot of all the variables supported by the migrate tool. All instructions below assume you are in the C:\Program Files\Microsoft Web Deploy\ directory at the command prompt.

  1. At the command prompt (In the C:\Program Files\Microsoft Web Deploy\ directory), type:
    msdeploy –verb:getDependencies –source:metakey=lm/w3svc/#siteidentifier

The list that is returned is fairly comprehensive as to what components are installed and available for use on the particular website. It does not, however, distinguish which components are actually in use.

Installing Required Components on Destination IIS7 Server

From the dependency list you can determine which roles need to be installed on the destination IIS7 Server. Any dependencies listed in the XML file that is saved during the migration will need to be installed on the destination server or else the migration will not complete. You can remove dependencies beforehand or from within the XML file found in the backup directory after the sync command.

Migrate Website

  • On the source IIS6 Server type:
    msdeploy -verb:sync  -source:metakey=lm/w3svc/# siteidentifier -dest:archivedir=c:\backup_name

Move the backup folder (c:\backup_name) to the destination server, or if on a network simply backup to the final destination on the IIS7 server or SAN.

  • On the destination IIS7 Server type:
    msdeploy -verb:migrate -source:archivedir=c:\backup_name -dest:metakey=lm/w3svc/# siteidentifier

After Migration

After the migration is complete, some elements will need to be re-configured. PHP, ASP.NET Ajax and others will need to be configured independently of the IIS migration to match the source server’s settings.

Related posts:

  1. Host Headers vs. Spam and How-to Setup on IIS6 and IIS7
  2. POP3 Protocol Missing in Windows 2008 / IIS7
  3. How to install PHP ISAPI on Windows 2008 IIS7 x64
  4. Outlook Error 0x80040154
  5. How to Configure a Shared Printer as LPT1/LPT2 in DOS

3 Responses to “Migrating websites from IIS6 to IIS7”

  1. Melonie
    October 21st, 2008 | 4:09 pm

    Hi -
    I am struggling trying to get this to work. I have ran the sync command, moved my content files and then I am able to run the msdeploy -verb:migrate -source:archivedir=c:\backup_name -dest:metakey=lm/w3svc/# siteidentifier but nothing has generated. What am I doing wrong? I am working with a test web site.

    I am new to the IIS7 stuff but I have 600+ web sites that I need to migrate from a IIS6 server to this new IIS7 server.

    I have the following dependencies but they are common and I am not sure how to check that they are all there.

    Any help would greatly be appreciated.

  2. Melonie
    October 21st, 2008 | 4:10 pm

    the message omitted my dependencies… here they are without the tags
    dependencies
    dependency name=”AnonymousAuthentication” /
    dependency name=”WindowsAuthentication” /
    dependency name=”IPSecurity” /
    dependency name=”ServerSideIncludeDisabled” /
    dependency name=”ASP” /
    dependency name=”AspNet1.1″ /
    /dependencies

  3. Chris
    October 22nd, 2008 | 8:37 am

    Hi Melonie,

    With the site identifier, you need to put in the actual number found in the IIS6 Console.

    Here is an example of the exact code I used to migrate iishacks.com from IIS6 to IIS7:

    msdeploy -verb:sync  -source:metakey=lm/w3svc/764477809 -dest:archivedir=z:\iisharch
    
    msdeploy -verb:getDependencies -source:metakey=lm/w3svc/764477809
    
    msdeploy -verb:migrate -source:archivedir=z:\iisharch -dest:metakey=lm/w3svc/764477809
    

    The number: 764477809 is the site identifier found in my IIS6 Console under Websites and the column “Identifier.”

    The destination for the backup z:\iisharch was on a shared drive between the two servers, so I was able to use that location for both commands. Obviously if you move it to the server and put it in a different directory, you’ll need to change the archiveddir= accordingly.

    Another note, when you do restore, it restores to the original location, so mine was restored to d:\sites\iishacks, which is stored in the XML files itself, so don’t worry about that.

    Another error you might come across is regarding ASP/ASPNET1.1 - If all the dependencies aren’t on the destination server, it won’t restore. So sometimes if you don’t actually need a dependency, you can just delete it from the XML file that is generated.

    Give me a shout if you have anymore problems.

    Chris

Leave a reply

...