Partilhar via


Migrating websites from IIS6 to IIS7

Many of the websites today are hosted on IIS 6.0 and the teams are migrating them to IIS 7.0 on a Windows Server 2008 platform. Microsoft Web Deployment tool is the perfect solution for these kinds of website migrations. The Web Deployment Tool simplifies the migration, management and deployment of IIS Web servers, Web applications and Web sites. Administrators can use command-line scripting with the Web Deployment Tool to synchronize IIS 6.0 and IIS 7.0 servers or to migrate an IIS 6.0 server to IIS 7.0. The Web Deployment Tool also enables administrators and delegated users to use IIS Manager to deploy ASP.NET and PHP applications to an IIS 7.0 server.

IIS7 replaces the aging metabase with a more convenient applicationHost.config which stores the configuration in XML.

Tool Download Location:

64 Bit: https://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=2c3b55b7-8bad-4f92-86c2-c3758237ab70

32 Bit (X86): https://www.microsoft.com/downloads/details.aspx?familyid=32A781A2-4961-49FC-B34D-170BFA78414F&displaylang=en

Below are the detailed steps to migrate websites from an IIS6 hosting to IIS7 host:

Install MS Deploy on the Source IIS6 Server:

  • You must have .NET Framework 2.0 SP1 or 3.5 installed on the server.
  • Download the filefrom the download location and run it on source server. 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:

  • 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.

  • Click Start -> Run -> type “cmd” and press OK.
  • 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)
  • Once in the target directory, type: appcmd add backup “BackupPreMigrate”
  • Press Enter. All done.
  • To display a list of previous backups type: appcmd list backup
  • To restore a backup, type: appcmd restore backup “BackupPreMigrate”

 

Verify Dependencies on Source IIS6 Server:

At the command prompt (In the C:\Program Files\IIS\Microsoft Web Deploy), type: msdeploy –verb:getDependencies –source:metakey=lm/w3svc/<#site Identifier> Where #site Identifier = Website number which you want to migrate (eg: 1 = Default Website, 2= Administration, 3 = Application1, etc..)

 

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_sitename
  • Move the backup folder (c:\backup_sitename) 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_sitename -dest:metakey=lm/w3svc/# siteidentifier

Post 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.

 

References:

https://technet.microsoft.com/en-us/library/dd569024(WS.10).aspx
https://www.iis.net/extensions/WebDeploymentTool

Comments

  • Anonymous
    September 15, 2010
    The command msdeploy -verb:migrate returns an error that migrate is not a recognized verb.

  • Anonymous
    November 02, 2010
    So what does msdeploy do? Is there any reason not to just copy the website files to the new iis7 directory? Why would I use it if I still have various unknown 'post migration'.

  • Anonymous
    February 28, 2011
    This does a single site. Have you come across any batch conversion scripts which can do a couple of 100 sites?

  • Anonymous
    April 13, 2011
    Hi Zeerover, MSDEPLOY does more thn just copy paste. It not only copies files but also the configurations of the websites. The below link gives more details on MSDEPLOY: www.hanselman.com/.../MSDeployNewIISWebDeploymentTool.aspx

  • Anonymous
    April 13, 2011
    Hi Evert, Yes i have migrated web servers with multiple sites (maynot be 100 but less). Just create a batch files with the commands mentioned in this article and run them on the source and destination servers. It works just great.

  • Anonymous
    April 13, 2011
    Hi Rick, This issue looks like a copy paste error rather than the command error. Try typing in the entire command and then it should work.

  • Anonymous
    May 12, 2011
    verb:migrate does not work with the latest version of msdeploy.

  • Anonymous
    September 25, 2013
    Hello Praveen - How do i use msdeploy to migrate a site/application from/to a remote servers where, the source files/folders are stored on different drive letters/folder names on the destination server. There is a rule for this but I find it complicated.  Can you advise? Thanks

  • Anonymous
    September 26, 2013
    Hi Volvo, Follow this link for the complete list of commands that you can use for MSDepoly: technet.microsoft.com/.../dd569089(v=ws.10).aspx Hope this helps. All the best for your Migrations. Cheers, Praveen