Migrating IIS 7.0 or 7.5

iis_map

Today Post topic will be migrating IIS 7.0 from a server to another server. I have a scenario where a client is migrating to AWS which I installed Server 2008R2 EC2 Instance with IIS 7.0. I have ELB on top of instances. Previous environment has Load Balancer which it will  be a lot of work to recreate website with the same settings on each web server.

When we created a website on IIS 7.0 or 7.5,  a unique application pool will also be created and used by the website. This will be the first thing We do to import these application pools first on the second web server before importing the websites.

To Export the Application Pools on IIS 7 :
%windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\apppools.xml

Above Command will export all the application pools on your web server. Hence 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

And other apppools which already exist on the second web server. Appcmd won’t detect and skip existing apppools, it will simply quit and won’t import any.

To import the Application Pools:
%windir%\system32\inetsrv\appcmd add apppool /in < c:\apppools.xml

All the AppPools on the .xml will be created on the second webserver.

To Export all you’re website:
%windir%\system32\inetsrv\appcmd list site /config /xml > c:\sites.xml

Above Command will export all websites on your webserver. Hence you need to edit the sites.xml and remove the websites which is not necessary for example:

  • Default Website

And all other websites that already exist on the second webserver.

To Import the website:
%windir%\system32\inetsrv\appcmd add site /in < c:\sites.xml

It is possible to export a single website or application pool. Simply add the name of the Application Pool or Website to the command line:

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:
%windir%\system32\inetsrv\appcmd list site “MyWebsite” /config /xml > c:\mywebsite.xml

Import:
%windir%\system32\inetsrv\appcmd add site /in < c:\mywebsite.xml

* Credit to microsoftpro.nl

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s