Link to home
Start Free TrialLog in
Avatar of gcrickman
gcrickmanFlag for United States of America

asked on

IIS7 - How to Save Configurations to a File for Applications, Application Pools and Virtual Directories

My company just started using Windows 2008 R2 and IIS 7.  Previously we were using Windows 2003 and IIS 6.  We have a number of applications that use IIS application pools, virtual directories and applications (applications only in IIS 7).

With IIS 6, it was very simple to replicate a pre-configured Application Pool or Virtual Directory.  All we had to do was select the Application Pool or Virtual Directory, right click it, choose All Tasks, and select Save Configuration to a File.  Then we could create a replica of the Application Pool or Virtual Directory by choosing "New Application Pool from File" or "New Virtual Direcotry from File".  This was very convenient, and it allowed us to 1) save configurations before we made any changes - in case we needed to restore them, and 2) create new Application Pools and Virtual Directories from previously saved configruation files.

With IIS 7, we cannot find the Save Configuration to a File feature in the IIS Manager's interface.  We've done some research, and it appears that Microsoft removed this functionality from the GUI in IIS7.  It seems they've replaced it with a command line tool called appcmd.  We can't find good documentation on the appcmd command line utility, so we're a bit reluctant to use it without a better understanding.

So, here is what we need to do:

- Save a specific Application Pool's configuration to a file.  Then, create a new Application Pool using the saved configuration file's information, parameters, etc.  And, of course, the new Application Pool would need to have a different name.

- Save a specific Virtual Directory's configuration to a file.  Then, create a new Virtual Directory using the saved configuration file's information, parameters, etc.  We realize we would still need to change some of the configuration information after the new Virtual Directory was created from the saved configuration file.

- Save a specific IIS "Application's" configuration to a file.  Then, create a new IIS Application using the saved configuration file's information, parameters, etc.  Again, we realize some of the configuration information would have to be changed after the new IIS Application was created.

We're not looking to transfer anything from one IIS server to another.  We're working with the same IIS server, and we want to replicate Application Pools, Virtual Directories, and IIS Applications.  

In our case, a vendor's installation originally created the original Application Pools, Virtual Directories, and IIS Applications.  We're a partner with the vendor and we host their applications in several data centers throughout the U.S.  The vendor originally create their applications for single company on premise deployments.  And, they've asked us to transform their applications into mult-tenancy applications.  This was easy to do in IIS 6, but we're not quite sure how to handle it in IIS7.

So, to summarize, we need to learn how to save configurations for IIS Applications, Application Pools and Virtual Directories using IIS7.  And, we need to learn how to create new applications, pools and virtual directories from those saved configuration files.  And, all of this needs to be done on the same IIS 7 server.  I'm over simplifying our configuration here, but if we can establish how to do the above on one IIS server, we can perform the same operations on our other IIS servers.

And, of course, everything needs to be done yesterday and there is no time for us to be re-trained on IIS 7.  So, I'm hoping someone can provide me with the procedures or the command line syntax for saving configuration files for specific IIS applications, pools and virtual directories.  And, I'm hoping someone can educate us on how to create new IIS applications, pools and virtual directories from the saved configuration files.

If we have to use the appcmd command line utility, we will.  But we'd love it if someone could give us the precise syntax for performing the above for specific IIS applications, pools and virtual directories.

Sorry for the long-winded question.  And, thank you very much in advance for your help.
Avatar of rjpilcher
rjpilcher

Avatar of gcrickman

ASKER

Thanks for the web site references!  Sadly, we previously reviewed these websites and neither of them provide specific syntax for saving configuration information to a file for a specific IIS application, application pool or virtual directory.  Nor do they provide the syntax for creating new IS applications, application pools or virtual directories from saved configuration files.

We want to learn how to save configuration information to files for specific IS applications, application pools and virtual directories on the same IIS server.  And, we want to be able to use the saved configuration files to create new IS applications, application pools and virtual directories on the same IIS server.

Thanks again for your reply - it is very much appreciated!
If I understand your question correctly what you are looking to do can be accomplished with APPCMD (a command line tool for managing IIS).

APPCMD will allow you to:
    Create and configure sites, apps, application pools, and virtual directories
    Start and stop sites, and recycle application pools
    List running worker processes, and examine currently executing requests
    Search, manipulate, export, and import IIS and ASP.NET configuration

I use APPCMD all the time to update portions or all of a configuration file for the IIS server (applicationhost.config) or for a specific site (web.config)

You may want to check out this page:
http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe
Thank you!  The web site you referenced (plus the information at mvolo.com/blogs) provides a great overivew of APPCMD.  I read all of the information on the web site plus the blogs.  I'm not trying to be lazy here (just careful), but I was wondering if you could provide me with the APPCMD syntax that would list and export to a file (probably xml) the configuration information for a specific Application, Application Pool and Virtual Directory?  And, the APPCMD syntax for creating new a new Application, Application Pool and Virtual Directory from the previously saved file that contains the configuration information.

From the web site you provided, I gather that I can run the following syntax:

%systemroot%\system32\inetsrv\APPCMD list apps "Default Web Site/MyApp" /config /xml > MyAppOutput.xml

My questions are:

1.  Does the above command provide all of the configuration information for the IIS Application?

2.  How can I use the APPCMD to add a new IIS Application using the saved configuration file (e.g. MyAppOutput.xml)?

3.  Assuming all of this is possible, could I use the same method for replicating Application Pools and Virtual Directories as well?

Thanks again for the web site reference.  I did read it all of its content.  Again, I'm not trying to be lazy, I just need some assurance (in the form of syntax) for creating new IIS Applications, Application Pools and Virtual Directories from saved configuration files.
ASKER CERTIFIED SOLUTION
Avatar of ServerGuyScott
ServerGuyScott
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Outstanding feedback!  We used this posting and your original posting, and we're in great shape now.  Many thanks!