Whether you’re looking to duplicate your web server’s site configuration to another server for development reasons or just migrating from one cloud server to another, using the “Shared Configuration” option in IIS is a good way to accomplish this. This feature is normally used to setup webfarm nodes so the configuration on two or more web nodes are identical. I will walk you through how to use this feature as a means to copy over each site’s configuration to another server running the same version of IIS. This will work for IIS 7, IIS 7.5 or IIS 8.
Although this does copy the site’s configuration over to the new server, there are some other things you need to do to make sure the sites work successfully. You need to prepare the destination server before you start. Make sure the destination server has the same IIS components installed as the original server. Install any IIS add-on’s or applications that your sites may use. For example, URL Rewrite, PHP, MySQL or the various .NET framework versions. You will need to export and import any SSL certificates your sites use from server1 to server2. You will also need to make sure the data for each site is placed in the same folder location on server2 just as they are on server1. If you use a custom identity user to run the application pools you will need to recreate them on the destination server.
Before beginning, you should backup the following configuration files for your sites on both servers, administration.config and applicationHost.config. The default location for these files are in C:\Windows\System32\inetsrv\config. In case you run into issues you can use the files to restore the configuration back to its original state. Now let’s get started with the steps to make this happen!
- Server1 – The server that currently contains your sites (Original server)
- Server2 – New server you want to duplicate your sites to (Destination server)
1) From server1 in IIS Management click the server name and in the right window pane under Management open the “Shared Configuration” icon.
2) In the Actions pane click “Export Configuration”
a. Select the location to store the files
b. Provide an Encryption key password (keep track of it for use on server2)
3) Copy the files to a folder location on server2 (administration.config and applicationHost.config)
4) Open the “Shared Configuration” icon in IIS Manager for server2
5) Check the box to “Enable shared configuration”
6) Enter the path to the exported configuration files on server2
7) Click Apply and input the Encryption key password. You will receive the message below.
8) Close and reopen IIS Manager, select the server name, click the Management Service icon and select Restart under the Actions menu (you may also choose to run iisreset at the command line)
Now confirm the sites are in place. You can disable “Shared Configuration” if everything is setup correctly. When you go to disable “Shared Configuration” you will be prompted to select “Yes” if you want to copy the new configuration back to the default folder location or select “No” if you do not want to import the new configuration but instead revert back to your original configuration. Select “Yes” to overwrite your original file configuration with the new configuration.
Check the Event Viewer to help troubleshoot any problems you run into with the sites.