IdP Versions Applicable: Any
Description: creating multiple application pools is great for applications, but can be a pain to migrate due to Microsoft's lack of IIS tools.
Resolution: utilize this script to load out the application pools and which realms belong to which application pools. Once that is done, so migrate the xml over and load in the application pools with the second command.
- In order to perform this action, there are a few steps to take. App pools are separate from the site, so first we will need to save off the app pools and bring that over to our other server and load it in.
To export app pools, please run the following from an elevated command prompt:
%windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\apppools.xml
It will look like this, with the file generated where you want to specify it.
- Next, you'll want to export your entire default web site, so we can get each individual realm configuration. We do this by another command of similar fashion.
Please run this command on the same elevated prompt:
%windir%\system32\inetsrv\appcmd list site /config /xml > c:\sites.xml
It will look something like this, with again, the file where you specify it.
- Once you have exported your configuration, it is time to move these two xml files over to your other server, and run these two commands to load in these app pools and default web site.
Before running the load in site command, please edit the xml to change the site value from 1 to 2. Elsewise, you'll have a conflict loading it in.
Same applies to the app pools, please remove the ones that are existing on this current server prior to running the import commands.
%windir%\system32\inetsrv\appcmd add apppool /in < c:\apppools.xml
%windir%\system32\inetsrv\appcmd add site /in < c:\sites.xml
- Once having done so, you will now have two default web sites, go ahead and remove your original one and rename the second, respectively, to the "default web site" name. In my case here, it was Test Site, so I then remove default web site, and rename accordingly.
- Remember to open bindings and bind your old cert to the new site.
- Now that's it! Do an iisrestart, and run through and ensure all your realms are working with their updated app pools. Remember to run through app pool permissions and such, since you have brought over new ones, especially if there are domain accounts being utilized in the app pool accounts.
Thanks Justin for the helpful pointers. One thing I will note for other readers is that, while his discussion here refers only to his having a default "site", the command used (appcmd list site) will indeed export ALL "sites" you may have, just as the import will do (and same for app pools).
That's both good and bad news: good for those who DO want to export many sites. "Bad" in that his cautions about the import potentially creating a dupe (of sites or pools) is all the more important to regard if your destination (where you import them) may also have more than one pool or site already, which might match what you are exporting.
I do realize the title conveys that the article is about exporting "sites", but since his text didn't really convey this (and he had only a single default site), I just wanted to add that clarification.
Please sign in to leave a comment.