Sunday, November 18, 2012

Exporting and Importing Sites and App Pools

When using multiple IIS server in a Load Balanced Environment it will  be alot of work to create all you’re website twice with the same settings on each webserver. Therefor it is possible to export and import you’re configuration from one webserver to the other.

To Export the Application Pools on IIS 7 :
%windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\apppools.xml
This will export all the application pools on you’re webserver, therefor you need to edit the apppools.xml and remove the application that you do not need to import for example:
  • DefaultAppPool
  • Classic .NET AppPool
  • SecurityTokenServiceApplicationPool
To import the Application Pools:
%windir%\system32\inetsrv\appcmd add apppool /in < c:\apppools.xml
All the AppPools in the xml will be created on you’re second webserver.



Command Line code for export and import site configuration

To export/import a single application pool:
%windir%\system32\inetsrv\appcmd list apppool “MyAppPool” /config /xml > c:\myapppool.xml

Import:
%windir%\system32\inetsrv\appcmd add apppool /in < c:\myapppool.xml

To export/import a single website:



C:\Windows\System32\inetsrv>appcmd list site "SmithersColombiaAnalytics" /config /xml > c:\soColmbAlty.XML


Import:



C:\Windows\System32\inetsrv>appcmd.exe add site /in < d:\import\soAustAlty.xml

 

No comments: