Freigeben über


Migration from IIS 6 to IIS 7.x – 8.x

 

I have completed numerous migrations for customers and the majority of the time is spent troubleshooting the migrated web applications on the new IIS platform. The migration process with Web Deploy is very quick and the testing and mitigation of the migrated applications will consume the bulk of the time spent on the project. The steps outlined in these blog posts will help guide the migration process https://technet.microsoft.com/en-us/library/ff633422(v=WS.10).aspx or https://www.iis.net/learn/publish/using-web-deploy/migrate-a-web-site-from-iis-60-to-iis-7-or-above

Detailed planning is the key to reducing issues encountered during the migration process. Please follow the steps outlined in this blog post to prepare for the migration: https://blogs.msdn.com/b/ericparvin/archive/2014/04/30/preparing-for-the-iis-migration.aspx

Unfortunately, cataloging the applications and creating test plans does not always fall into the job description of a server admin and may seem burdensome. However, the key take-away from the planning process is being able to effectively declare the web application is successfully migrated and there must be a clear definition of success. Success can either be defined as having the application compile on the new server and for the login screen or first page appear in the browser for each application. Or, working through the test plan to ensure each page functions correctly . This must be decided before the migration occurs otherwise there will never be a clear definition of success and the project will continue and not have a clear end.

The following steps in the migration process are what has helped make migrations successful with my customers and go beyond the steps outlined in the blog posts mentioned in the first paragraph. The steps are broken out by the type of migration being performed with an entire server level migration first, moving to a web site, and the last option is moving just the application.

The key difference between using these Web Deploy commands on an IIS 7.x or IIS 8.x server is the is the syntax used on the –source switch. Web Deploy requires the use of webServer60 or metakey=lm/w3svc/1 to properly identify the site on IIS 6.0 servers.

Sever Level Migration:

This method can be accomplished with either a Web Deploy package migration using the Inetmgr GUI, or the Web Deploy command line to copy the files and settings to the new server.

The -source switch for migrating an entire server is webServer.

Example Syntax:

msdeploy.exe -verb:sync -source:webServer60,computername=10.0.0.11 -dest:webServer,computername=10.0.0.12

Housekeeping:

· Source server = Server sending the web files

· Target server = Server receiving the files (new server)

· For these examples, the Source server IP is 10.0.0.11 and the Target server is 10.0.0.12.

Backup on Target Server:

Make a backup of the IIS configuration settings on the target server using IIS backup and the web deploy tool to back up the web.config files:

%windir%\system32\inetsrv\appcmd add backup “PreWebDeploy”

AND

msdeploy -verb:sync -source:webServer -dest:package=c:\IISMigration \PreWebDeploy.zip

Note:

The Appcmd utility backs up the IIS settings for the target IIS Server and the Web Deploy utility backs up the IIS settings AND the web files. An extra layer of security and a quick restore option.

Command Line Package Creation Method:

From the command prompt, enter the following commands to create a differencing file and mechanism to review errors and warnings before generating the package file:

msdeploy.exe -verb:sync -source:webServer60,computername=10.0.0.11 -dest:webServer,computername=10.0.0.12 -enableLink:AppPoolExtension –verbose -whatif > c:\IISMigration\ServerDiff.txt

Note: The command switch -source:webServer is the equivalent to the IIS server level. This means, include everything on this IIS server in the package.

Inspect the output in the text file by searching on Error and Warning and resolve the issues before generating the package. Again, the pipe command to the file is optional and output from the WhatIf command can be viewed within the command window. This is what a successful test migration would look like.

image

Generate the Package to Transfer:

From the command prompt, enter the following commands to create a Web Deploy package:

msdeploy -verb:sync -source:webserver60 -dest:package=c:\IISMigration\SourceServer.zip

Copy the package to the target server and import using the following command to test before the import:

msdeploy -verb:sync -source:c:\IISMigration\SourceServer.zip -dest:webServer -enableLink:AppPoolExtension –verbose -whatif > c:\IISMigration\ SourceImportWhatIf.txt

Inspect the output in the text file by searching on Error and Warning and resolve the issues before generating the package.

Final command to complete the migration by omitting the –whatif command:

msdeploy -verb:sync -source:c:\IISMigration\SourceServer.zip -dest:webServer -enableLink:AppPoolExtension –verbose > c:\IISMigration\

Command Line Method without Packages:

This method generates a server to server transfer of IIS settings and files and the fastest method.

From the command prompt, enter the following commands to create a differencing file to review errors and warnings before generating the package file:

msdeploy.exe -verb:sync -source:webServer60,computername=10.0.0.11 -dest:webServer,computername=10.0.0.12 -whatif > c:\IISMigration \ServerDiff.txt

Note: The –whatif command can pipe to the command window instead of the file by omitting the pipe command.

Inspect the output in the text file by searching on Error and Warning and resolve the issues before generating the package:

msdeploy.exe -verb:sync -source:webServer,computername=10.0.0.11 -dest:webServer,computername=10.0.0.12 > c:\IISMigration \SourceToTargerServerMigration.txt

Inetmgr Package Creation Method:

The easiest method is generate a package from the source server through the Inetmgr GUI and copy the package to the target server and import the package. The wizard allows for multiple different options and is easy to follow.

On the source IIS server, open Inetmgr and select the server level node in the connections pane.

image

In the Actions pane, select the Deploy section has the Export Server Package option to start the wizard.

image

Save the package on the source server and transfer to the target IIS server and repeat the process except select the Import Server or Site Package option to start the wizard.

Alternative Methods for Sync Export/Export:

Push-

From the IIS 6 server, issue the following command (Push):

msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:metakey=lm/w3svc/1 ,computername=10.0.0.5 -whatif > c:\iismigration\pushmigration.log

image

Check the log for any errors and proceed with the actual command:

msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:metakey=lm/w3svc/1 ,computername=10.0.0.5

Pull-

From the IIS 7.x server run the following command:

msdeploy -verb:sync -source:metakey=lm/w3svc/1 ,computername=10.0.0.5 -dest:metakey=lm/w3svc/1 -whatif >c:\iismigration\pullmigration.log

image

Back Out Plan:

appcmd list backup

appcmd restore backup "PreMigration"

 

Web Site Level Migration:

This scenario will migrate all of the web server's bindings, certificates, and other high level web site information during the migration effort. This is for a single web site and all of the related applications under the web site.

The -source switch for migrating an entire server is metakey.

Note: This scenario can only be accomplished with the Web Deploy command line.

Example:

msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:appHostConfig="Hello",computerName=10.0.0.12

Contoso.com= Web Site

Housekeeping:

Source server = Server sending the web files

Target server = Server receiving the files (new server)

For these examples, the Source server IP is 10.0.0.11 and the Target server is 10.0.0.12.

Backup on Target Server:

Make a backup of the IIS configuration settings on the target server using IIS backup and the web deploy tool to back up the web.config files:

%windir%\system32\inetsrv\appcmd add backup “PreContosoV2_Deploy”

AND

msdeploy -verb:sync -source:appHostConfig="Contoso.com" -dest:package=c:\_WebDeploy\PreContosoUpdate.zip

Migration Options:

There are two options presented to migrate the web site. The first option generates a Web Deploy package in the .zip format and this package is copied to the destination server. The second option performs the migration directly from the command prompt and is the fastest method. With both methods, please verify the results from the migration is the expected result by using the –whatif command to ensure a successfully migration.

Verify before Execution:

From the command prompt, enter the following commands to create a differencing file and mechanism to review errors and warnings before generating the package file:

msdeploy.exe -verb:sync -source:metakey=lm/w3svc/1,computername=10.0.0.11 -dest:appHostConfig="Contoso.com",computername=10.0.0.12 –verbose -whatif > c:\IISMigration\ServerDiff.txt

Note: The command switch -source:metakey is the equivalent to the IIS web site level. This means, include everything in the web site when creating the package.

Note: To find the site's number to use as a parameter:

Open the metabase.xml file (c:\Windows\system32\inetsrv\Metabase.xml

Search for the site name in the file

The <IIsWebVirtualDir Location> tag will show the number of the site.

Inspect the output in the text file by searching on Error and Warning and resolve the issues before generating the package. Again, the pipe command to the file is optional and output from the -WhatIf command can be viewed within the command window.

Note: If the website on the Target does not exist, the output from the -whatif statement will show all adds and no deletes.

Package Transfer Method:

From the command prompt, enter the following commands to create a Web Deploy package:

msdeploy -verb:sync -source: metakey=lm/w3svc/1 -dest:package=c:\IISMigration\SourceServerContosoSite.zip

Copy the package to the target server and import using the following command to test before the import:

msdeploy -verb:sync -source:c:\IISMigration\SourceServerContosoSite.zip -dest:appHostConfig="Contoso.com" –verbose -whatif > c:\IISMigration\SourceImportWhatIf.txt

Inspect the output in the text file by searching on Error and Warning and resolve the issues before generating the package.

Open the command prompt on the target server, run the following command to complete the migration:

msdeploy -verb:sync -source:c:\IISMigration\SourceServerContosoSite.zip -dest:appHostConfig="Contoso.com"

Command Line Method without Packages:

This method generates a server to server transfer of entire website settings and files.

From the command prompt, enter the following commands to create a differencing file and mechanism to review errors and warnings before generating the package file:

msdeploy.exe -verb:sync -source:metakey=lm/w3svc/1,computername=10.0.0.11 -dest:appHostConfig="Contoso.com",computername=10.0.0.12 -whatif > c:\IISMigration\WebSiteDiff.txt

Inspect the output in the text file by searching on Error and Warning and resolve the issues before generating the package. The output file is the history of the migration and can be archived.

msdeploy.exe -verb:sync -source:metakey=lm/w3svc/1,computername=10.0.0.11 -dest:appHostConfig="Contoso.com",computername=10.0.0.12 > c:\IISMigration\SourceToTargerWebSiteMigration.txt

Application Level Migration:

This method is used to migrate a web application hosted under a web site to a new server.

Here is the link to the TechNet content about the iisApp provider- https://technet.microsoft.com/en-us/library/dd569054(v=WS.10).aspx

Note: This scenario can only be accomplished with the Web Deploy command line OR the Internet Manager GUI.

Example Syntax:

The -source switch in Web Deploy for migrating an application is metakey and it migrates the directory content to a folder and marks the folder as an application.

Example:

msdeploy -verb:sync -source:metakey=lm/w3svc/1/PayCalculator -dest:iisApp="Contoso.com/PayCalculator",computername=10.0.0.12

  • Web Site = Contoso.com
  • PayCalculator = Web Application

Migration Options:

There are two options presented to migrate the application. The first option generates a Web Deploy package in the .zip format and this package is copied to the destination server. The second option performs the migration directly from the command prompt and is the fastest method. With both methods, please verify the results from the migration is the expected result by using the –whatif command to ensure a successfully migration.

Verify before Execution:

From the command prompt, enter the following commands to create a differencing file and mechanism to review errors and warnings before generating the package file:

msdeploy -verb:sync -source:metakey=lm/w3svc/1/PayCalculator -dest:iisApp="Contoso.com/PayCalculator",computername=10.0.0.12 -whatif > c:\IISMigration\PayCalculatorDiff.txt

Inspect the output in the text file by searching on Error and Warning and resolve the issues before generating the package. Again, the pipe command to the file is optional and output from the WhatIf command can be viewed within the command window.

Note: If the application on the Target does not exist, the output from the -whatif statement will show all adds and no deletes.

Package Transfer Method:

Create Application Package on Source Server:

There are two methods to create the package presented below and at end of the day, produce the same result. It all depends on the level of comfort using the GUI over the command line.

Inetmgr GUI:

Open Inetmgr and select the web site and application to migrate. Select the Export Application utility on the GUI and follow the steps within the wizard.

image

Command Line:

msdeploy -verb:sync -source:metakey=lm/w3svc/1/PayCalculator" -dest:package=c:\IISMigration\PayCalculator.zip

Copy the Web Deploy package to the new server.

Import Site on Remote Server:

InetMgr GUI:

Open Inetmgr and select the web site and application to migrate. Select the Import Application utility on the GUI and follow the steps within the wizard.

Command Line:

msdeploy -verb:sync -source:c:\IISMigration\PayCalculator.zip -dest:iisApp="Contoso.com/PayCalculator" > c:\IISMigration\PayCalculatorDeployment.txt

Command Line Method without Packages:

This method generates a server to server transfer of the web application and omits the use of packages. It will synchronize the differences between the source and the target server at the application level.

msdeploy -verb:sync -source:metakey=lm/w3svc/1/PayCalculator -dest:iisApp="Contoso.com/PayCalculator",computername=10.0.0.12 > c:\IISMigration\PayCalculatorDeployment.txt

To include the application pool settings, use the -enablelink:AppPoolExtension switch in the statement as such:

msdeploy -verb:sync -source:metakey=lm/w3svc/1/PayCalculator -dest:iisApp="Contoso.com/PayCalculator" –enableList:AppPoolExtension,computername=10.0.0.12 > c:\IISMigration\PayCalculatorDeployment.txt

Comments

  • Anonymous
    February 11, 2015
    Hi, I have migrated the application from IIS 6 to IIS 7 using msdeploy tool. There are around 50 application created under the default website. Using msdeploy tool I have migrated. All the application,content and everything are set as like IIS 6 except application pool. all the migrated application in IIS7 are sits under default application pool. Dedicated application pool are missing in the new servers. Can you help and provide step by step instruction that how to migrate all the application without missing the dedicated app pool.  

  • Anonymous
    February 11, 2015
    Use the -enablelink:AppPoolExtension  extension and it will carry over the application pools for each application. The last example in the blog post will show how to use the extension.

  • Anonymous
    February 11, 2015
    Hi Eric, We have included "-enablelink:AppPoolExtension" but still the dedicated app pool is not found in the IIS 7 server. One more information like all the dedicated app pools are configured with the service account in IIS 6. its not running under "network services". Do you think because of this app pool is not get migrated. Can you please suggest

  • Anonymous
    April 01, 2015
    Hi Manoj    Is the above issue rectified , we have similar need . Please share your comments Thanks

  • Anonymous
    April 01, 2015
    Please use the -verbose and -whatif statements in the command to identify why the application pools are not being migrated. The command would look like this: msdeploy -verb:sync -source:metakey=lm/w3svc/1/PayCalculator -dest:iisApp="Contoso.com/PayCalculator" –enableList:AppPoolExtension,computername=10.0.0.12 -verbose -whatif > c:IISMigrationPayCalculatorDeployment.txt

  • Anonymous
    July 27, 2015

  1. There is typo it should be -enableLink instead of -enableList
  2. It is confirmed that -enableLink:AppPoolExtension DOES NOT create associated Application Pools. Scenario was IIS-6 to IIS-7.5 migration. Thanks, SamD
  • Anonymous
    July 28, 2015
    In above scenario no. 2: Application Pool does not get created when syncing single application.
  1. -enableLink:AppPoolExtension DOES create all associated Application Pool only when we sync complete webserver with below command msdeploy -verb:sync -source:metakey=lm/w3svc/1,computername=<xyz> -dest:metakey=lm/w3svc/1 -enableLink:AppPoolExtension -vebose -whatif > d:msdep_sync.txt Thanks, SamD
  • Anonymous
    September 01, 2016
    Hello ,I need to migrate the My IIS 6.0 Version sites in to IIS 8.5 Version. Kindly help me how to migrate and share the steps also.OS Version : OS from windows 2003 to Windows 2012 R2Note : we don't have "appcmd" in IIS 6.0 version, so i cannot export the apppool and site in same servr. and also we have huge size of file and 400+ virtual application in the one site.I have moved the all the drive and content in to new server with same drive name. Can you please share the best solution and approach.ThanksRajesh Kannan
    • Anonymous
      October 13, 2016
      From IIS 6.0, you can export the web site and applications using the Web Deploy GUI add-in for Internet Manager (start->run->inetmgr) and then copy the package to the new IIS server and import. Does not matter on the number of applications and should only take a few minutes to restore.
      • Anonymous
        January 24, 2017
        HiDoes it also copy unc passwords too. We have virtual directories with unc name and unc password.
        • Anonymous
          January 24, 2017
          Can you post the command you are using to migrate the website? I would have to look into the option on copying UNC passwords, or ask the Web Deploy team.
  • Anonymous
    November 04, 2016
    I need to use Web Deploy, or anything for that matter, to migrate an entire IIS environment from one Hosting provider to another. My customer is a website design company. I seem to becoming unstuck because unlike the usual method of using Webdeploy this time, the source machine is on a different network and Domain to the target machine.Thanks. Staceman
    • Anonymous
      November 15, 2016
      The comment has been removed