IIS7 has this great new feature called Shared Configuration.  Except that it has a tendency to do horrible things which usually result in all the websites and application pools being removed from your server and your production website starting to serve 503 Service Unavailable errors.

For an innexplicable reason, Microsoft decided to kill the Export function from IIS7 in favor of this new feature.  But for those of us who don’t trust technology, we like to do things manually and to get a repeatable result that doesn’t update automatically when we least expect it.  Yes, I am the sort of person who wonders why the default Windows Update on servers is to Install and Reboot Automatically at 2am…

In any case, in a simple 3 step process you too can export and import your Internet Information Server 7 websites and app pools.

I will call the target server TWEB (this is the server where you want a duplicate configuration) and the source server SWEB (this is where the current configuration exists).

First, on TWEB make a backup copy of the files in C:\Windows\System32\inetsrv\config.  I just created a subfolder called “bak” and copied them.  This is very important.  If you forget or skip this step because backups are for sissies, you will be re-installing IIS7 in step 4.

Second, copy the AppliationHost.config from SWEB into the C:\Windows\System32\inetsrv\config folder on TWEB.  Also copy any application files like your c:\websites folder or whatever over to TWEB in the appropriate location if you haven’t already.

Third, on TWEB open both the new ApplicationHost.config and the backup ApplicationHost.config from step 1 and locate the <configProtectedData> node in the backup.  Copy that node and replace it into the new config file.

Fourth, if you didn’t backup the existing config file, remove the IIS role and add it back, then start at step 1.

Note: if you have custom accounts under which you’re running app pools (cuz you’re not using LocalSystem, right?) then you just need to go into the IIS Management Console and re-configure the passwords for those accounts.  They were encrypted with the other server’s AES keys so they won’t be valid on this server and the pools won’t start.

That’s it.  Hope that helps.  It should work the same for C# .NET applications (which is what I’m using) or just static websites or whatever.  But of course, you shouldn’t trust me.  Test it yourself first.

My new good-karma policy is that if I spend more than an hour tracking down a general bug or wacky configuration thing, I promise to blog the solution.



COMMENTS / 15 COMMENTS

Aztec Appliances…

[...]below you’ll find the link to some sites that we think you should visit[...]…

Aztec Appliances said on Dec 13 11 at 5:44 am

This saved me a lot of time on my web farm upgrade. Thanks!

Stu said on Jul 08 09 at 9:28 am

Thank you! The config entry is what was holding me up :)

Jason Vetter said on Jan 16 10 at 5:37 am

Great post … took me 15 minutes to migrate a site that took 3 hours last time.

Tyler said on Jan 20 10 at 3:20 pm

this saved me a lot of time. thank u for this article.

takalani said on Jul 08 10 at 1:26 am

Thanks, this works really well!

Harvey said on Oct 28 10 at 7:39 am

When all else failed, once I found your article I was able to solve my additional new server configurations in just a few minutes using your solution.

The only other thing I had to do was reconfigure environment-specific information in the IIS 7 configuration (dedicated redirect local to each environment for one Virtual Directory due to a proxy plug-in), and for some reason an IIS 7 Restart did not pick up the change, so a Stop and then Start did the trick.

David said on Nov 03 10 at 6:58 am

Do we have to make sites manually on new server or everything gets copied. I tried above whole procedure and ended up with fodlers instead of sites under default websites in ISS on new server.
What did i do wrong?

R said on Jul 25 11 at 7:14 am

Thank you! This got me up and running in a jiffy. This makes migrating IIS7 servers a snap. Much appreciated.

Paul Adams said on Aug 04 11 at 7:09 pm

I want to backup config iis 7 for each website, which is when iis 7 malfunction then restore the config files of many other websites also paralyzed when we backup. In IIS 6, the backup can be. in iis 7 so I do?

TienVung said on Sep 07 11 at 8:14 pm

Thanks a lot. Worked like a charm!

Bo said on Sep 22 11 at 8:59 am

THANK YOU!! Simply fantastic.

Alan Rogers said on Oct 26 11 at 3:58 pm

Note that if you had various extensions installed in iis7 on SWEB they’ll be referenced in the config file and you’ll need to install them on TWEB or you’ll get errors and the web site and pool will shut down after trying to access the site. Look in eventlog – application errors to get a hint as to which extensions are missing e.g. urlrewrite.

Warren said on Nov 27 11 at 8:02 am

Thanks for posting. I will be trying this soon since we are not using shared configs on any of our iis7 webservers. I will post how it went.

joe said on Dec 29 11 at 2:59 pm

I tried the same but it is not working for me , getting Httpredirection error in event vwr, even iam unable to browse the http://localhost itself. But iam able to see the all required configuration in target Svr but no use as the pages are not getting . Thrwowing 503 Service Unaviabnel error. Please help me out on this. Thanks Advance.

Bhaskar said on Feb 01 12 at 8:32 am

SPEAK / ADD YOUR COMMENT
Comments are moderated.

Return to Top

HOWTO: Export IIS7 Configuration to Another Webserver

FRESH / LATEST POSTS

FRESH / Twitter Updates