How do you migrate an IIS 7 site to another server?

DeploymentIis 7Migrate

Deployment Problem Overview


I'm wondering what is the best practice for moving a website to another server (along with all settings, etc.)

  • Manually recreate the site on the new server (not maintainable for obvious reasons)
  • Copy the applicationHost.config settings file
  • Use appcmd to make a backup and restore
  • Use MSDeploy to publish the site on the new machine
  • Use a 3rd party tool

Just wondering what others' experiences have been.

Deployment Solutions


Solution 1 - Deployment

I'd say export your server config in IIS manager:

  1. In IIS manager, click the Server node

  2. Go to Shared Configuration under "Management"

  3. Click “Export Configuration”. (You can use a password if you are sending them across the internet, if you are just gonna move them via a USB key then don't sweat it.)

  4. Move these files to your new server

     administration.config
     applicationHost.config
     configEncKey.key 
    
  5. On the new server, go back to the “Shared Configuration” section and check “Enable shared configuration.” Enter the location in physical path to these files and apply them.

  6. It should prompt for the encryption password(if you set it) and reset IIS.

BAM! Go have a beer!

Solution 2 - Deployment

MSDeploy can migrate all content, config, etc. that is what the IIS team recommends. http://www.iis.net/extensions/WebDeploymentTool

To create a package, run the following command (replace Default Web Site with your web site name):

msdeploy.exe -verb:sync -source:apphostconfig="Default Web Site" -dest:package=c:\dws.zip > DWSpackage7.log

To restore the package, run the following command:

msdeploy.exe -verb:sync -source:package=c:\dws.zip -dest:apphostconfig="Default Web Site" > DWSpackage7.log

Solution 3 - Deployment

Here is a helpful website on using appcmd to export/import a site configuration. http://www.microsoftpro.nl/2011/01/27/exporting-and-importing-sites-and-app-pools-from-iis-7-and-7-5/

Solution 4 - Deployment

Microsoft Web Deploy v3 can export and import all your files, the configuration settings, etc. It puts it all into a zip archive ready to import on the new server. It can even upgrade to newer versions of IIS (v7-v8).

http://www.iis.net/extensions/WebDeploymentTool

After installing the tool: Right click your server or website in IIS Management Console, select 'Deploy', 'Export Application...' and run through the export.

On the new server, import the exported zip archive in the same way.

Solution 5 - Deployment

use appcmd to export one or all the sites out then reimport into the new server. It could be iis7.0 or 7.5 When you export out using appcmd, the passwords are decrypted, then reimport and they will reencrypt.

Solution 6 - Deployment

I can't comment up thread due to lack of rep. Another commenter stated they couldn't migrate from a lower version to a higher version of IIS. This is true if you don't merge some files, but if you do you can as I just migrated my IIS 7.5 site to IIS 8.0 using the answer posted by chews.

When the export is created (II7.5), there are two key files (administration.config and applicationHost.config) which have references to resources on the IIS7.5 server. For example, a DLL will be referred with a public key and version specific to 7.5. These are NOT the same on the IIS8 server. The feature configuration may differ as well (I ensured mine were identical). There are some new features in 8 which will never exist in 7.5.

If you are brave enough to merge the two files - it will work. I had to uninstall IIS once because I messed it up, but got it the second time.

I used a merge tool (Beyond Compare) and without something equivalent it would be a huge PITA - but was pretty easy with a good diff tool (five minutes).

To do the merge, the 8.0 files need to be diffed against the exported 7.5 files BEFORE an import is attempted. For the most part, the 8.0 files need to overwrite the server specific stuff in the exported 7.5 files, while leaving the site/app pool specific stuff.

I found that administration.config was almost identical, sans the version info of many entries. This one was easy.

The applicationHost.config has a lot more differences. Some entries are ordered differently, but otherwise identical, so you will have to pick through each difference and figure it out.

I put my 7.5 export files in the System32\inetsrv\config\Export folder prior to merging.

I merged FROM folder System32\inetsrv\config to folder System32\inetsrv\config\Export for both files I mentioned above. I pushed over everything in the FROM files except site specific tags/elements (e.g. applicationPools, customMetadata, sites, authentication). Of special note, there were also many site specific "location" tag blocks that I had to keep, but the new server had its own "location" tag block with server specific defaults that has to be kept.

Lastly, do note that if you use service accounts, these cached passwords are junk and will have to be re-entered for your app pools. None of my sites worked initially, but all that was required was re-entering the passwords for all my app pools and I was up and running.

If someone who can comment mention this post down thread - it will probably help someone else like me who has many sites on one server with complicated configurations.

Regards,

Stuart

Solution 7 - Deployment

In my case, the files were already copied, I found the easiest way to follow the steps in this guide: https://www.ryadel.com/en/exporting-importing-app-pools-and-websites-configuration-between-multiple-iis-instances/

I exported AppPools/Websites, copied the xml files to the destination server and Imported AppPools then Websites. Worked very well. This is also another excellent option for this question.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKalidView Question on Stackoverflow
Solution 1 - DeploymentchewsView Answer on Stackoverflow
Solution 2 - DeploymentBill StaplesView Answer on Stackoverflow
Solution 3 - DeploymentRoyView Answer on Stackoverflow
Solution 4 - DeploymentZymotikView Answer on Stackoverflow
Solution 5 - DeploymentJimView Answer on Stackoverflow
Solution 6 - DeploymentStuartView Answer on Stackoverflow
Solution 7 - DeploymentRalphView Answer on Stackoverflow