Posted by & filed under Internet Information Server, Windows / Server.

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.

(4.00 out of 5)

9 Responses to “Migrating websites from IIS6 to IIS7”

  1. Melonie

    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.

    Reply
  2. Melonie

    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

    Reply
  3. Chris

    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

    Reply
  4. Justin

    Hi Chris

    Is it at all possible to have only the XML/Metadata/SiteInfo exported, instead of doing a full data archive with site info?

    The situation I’m in is this, I have a IIS6 website and wish to migrate it to IIS7, but there are certain file locks on files in the source data directory. Another problem I have, is that, using the example you’ve given above, I don’t get any ACL info.

    The end result is that the archiving process fails, and the XMLs arent created.

    The easiest solution from me, would be to get the site info across (so that I have the websites and their associated virtual directories etc), and then restore the data by hand to the IIS7 machine.

    Any ideas on my errors, or how to get the end result I require?

    Tx,
    Justin

    Reply
  5. Tom

    Executing MSDeploy results in:

    C:\Program Files\IIS\Microsoft Web Deploy>msdeploy -verb:getDependencies -source
    :metakey=lm/w3svc/876095251
    Error: Unrecognized argument ‘-verb:getDependencies’. All arguments must begin
    with -
    Error count: 1

    C:\Program Files\IIS\Microsoft Web Deploy>msdeploy -verb:getDependencies -source
    :metakey=lm/w3svc/876095251
    Error: Object of type ‘metaKey’ and path ‘lm/w3svc/876095251′ cannot be created

    Error: The metabase key ‘/lm/w3svc/876095251′ could not be found.
    Error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
    Error count: 1

    What is wrong?

    /Tom

    Reply
  6. TP

    Hey Tom,

    I encountered this problem (so far on 64-bit OS’s) on win2K3 and win2K8 (not only IIS realted but SharePoint too (Stsadm.exe) and its because you copied and pasted the command from a website. It seems silly I know, try and type the whole command in manually and it should work.

    Reply
  7. Micheal Kilpatric

    One thing to note: When creating archive copies of sites (if you have multiple or one), and you get the error about a property being marked as secure (ex: Error: The property ‘blob’ located at ‘/metaKey[@path='/lm/w3svc/584088123']/metaProperty[@name='SSLCertHash']/cert’ is marked as secure. You must specify an encryption password to archive this property.
    Error count: 1.), you must then use the option encrpytPassword= for both SOURCE and DESTINATION (if archiving or migrating sites).

    My example command that was successful: (I was migrating individual sites from within my core IIS6 server to a 64 bit IIS7 server)

    C:\temp\archiveALL\178644647>msdeploy -verb:sync -source:metakey=lm/w3svc/584088
    123,encryptpassword=abc1 -dest:archivedir=c:\temp\archiveALL\584088123,encryptPa
    ssword=abc1 -allowUntrusted > c:\temp\archiveall\584088123.log

    Just to help those that may run across this, as I couldn’t find it anywhere on the correct syntax of the encryptPassword setting.

    MK

    Reply
  8. Dodie Sandstede

    Other online backup services that offer seeded backup include CrashPlan and Mozy (Data Shuttle).

    Reply

Trackbacks/Pingbacks

  1.  Confluence: IT Knowledgebase

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>