Migrating IIS7 Site Settings

Location: BlogsRevindexASP.NET    
Posted by: revindex 9/28/2008 5:05 AM

Previously in IIS 5 and 6, you could export Site configuration settings and import them back on another machine making server migration very easy. When IIS 7 came along, we lost that command in the IIS Manager. Fortunately, there is now a new set of command lines that can do almost the same thing.

To export the web site settings (change "My Site" to the name of your site):

> %windir%\system32\inetsrv\AppCmd.exe LIST SITE "My Site" /config /XML > mysite.xml

To import the settings, do this:

> %windir%\system32\inetsrv\AppCmd.exe ADD SITE /IN < mysite.xml

Note the Application Pool will still need to be created manually including any SSL certificate and IP addresses binding need to be re-configured.

Permalink |  Trackback

Comments (6)   Add Comment
Re: Migrating IIS7 Site Settings    By Jimmy Microsoft on 9/28/2009 7:50 PM
Yet another example of why Microsoft is making every version of OS after 2003/XP a downgrade. Pathetic.... Go from DOS command lines to a complex gui, back down to a DOS command line level that's 1000000 times more complex than DOS. Why does microsoft consistantly change good products into pathetic trash? IIS7 is terrible.

Re: Migrating IIS7 Site Settings    By Johnny Microsoft on 5/27/2010 4:01 PM
Command line utils are best for scripting configuration during automated builds. GUIs are good for initial configuration. So, both are good.

Re: Migrating IIS7 Site Settings    By Prodis a.k.a. Fernando Hamasaki de Amorim on 6/24/2010 10:27 AM
Thank you for information.

Re: Migrating IIS7 Site Settings    By JS on 7/23/2010 11:30 AM
Thanks for the info but it doesn't actually work. Did you actually test this out?

I tried this and I get a "ERROR ( message:Failed to add duplicate collection element "Default Web Site". )" error message which renders this useless. I've wasted several hours trying to get this to work when I could have done it in the UI. Whats the point of command line if they don't make things any quicker?!?

Re: Migrating IIS7 Site Settings    By slim on 7/23/2010 11:33 AM
Yes it works. Make sure you don't already have a "Default Web Site" on your destination server. The command is preventing you from overwriting your existing site for your own safety. Either delete the "Default Web Site" or figure if the command can use a flag to overwrite.

Re: Migrating IIS7 Site Settings    By chinkle on 8/21/2010 8:31 AM
In addition to the site name, you'll also need to change the site ID to a unique value. It's listed twice under and .

Your name:
Add Comment   Cancel