Post Pic

Use AppCmd to Migrate web.config from IIS6 to IIS7

Further to my earlier post I encountered another issue migrating sites for a client from IIS6 to IIS7. If your site uses any httpHandlers or httpModules you will need to perform these steps to migrate your web.config to include the missing configuration sections required by IIS7.

First of all I would suggest listing out all sites using AppCmd and the following command:

%systemroot%system32inetsrvAPPCMD list sites

Your output should be similar with the following:

SITE "Default Web Site" (id:1,bindings:HTTP/*:80:,state:Started)

SITE "Site1" (id:2,bindings:http/*:81:,state:Started)

SITE "Site2" (id:3,bindings:http/*:82:,state:Stopped)

Make a note of the object specific identifier in quotes as you will need this to specify the website/app whose web.config you wish to migrate.

Next you will need to run another command to perform the migration as follows:

%systemroot%system32inetsrvAPPCMD.EXE migrate config "object-specific-identifier/"

There is a very important point worth noting here as it caught me out for quite a while, be sure to include a trailing slash after your object specific identifier or the command will fail.

All being well your should get a message similar to this confirming the web.config has been migrated.

Successfully migrated section "system.web/httpModules".
Successfully migrated section "system.web/httpHandlers".

That’s it, for me the app was back up and running again after these steps.

Umbraco Certified Developer
SagePay Approved Partner
Creative Market