Click here to Skip to main content
Click here to Skip to main content

Managing virtual directories on multiple IIS sites and servers

By , 25 May 2005
 

Introduction

Did you ever face the need of maintaining a family of similar web applications, eventually hosted on multiple web servers in a farm? If yes, for sure you must have discovered how uncomfortable the standard IIS management user interface (the "IIS Manager" MMC) can be for this kind of tasks. In fact, its classical "tree on the left / details on the right" structure is not suitable for the management of different web sites "in parallel", because it forces the user to concentrate each time on a specific node or sub tree of the hierarchical structure.

In my experience, I felt the lack, in "IIS Manager", of such a cross-application and cross-server transversal management when dealing with virtual directories of a web site developed in nine languages and hosted on a 10 web servers farm. Then, I wrote a simple tool (named Virtual Directory Viewer) useful to check virtual directory settings on multiple web sites and web servers, through a tabular "synoptic view" obtained programmatically inspecting the IIS metabase.

The Virtual Directory Viewer

Basically, the behavior of the Virtual Directory Viewer is very simple:

  • at the beginning, you have to configure the list of the web sites and of the IIS servers you need to inspect;
  • then, the tool collects data about virtual directories defined under the web sites specified by you;
  • the collected data are presented in the form of a matrix: each column represents a web site, each row represents a virtual directory, each cell holds the physical path to which the specific virtual directory is pointing to;
  • the shown matrix can be easily transposed and/or sorted (for a more comfortable reading), and it can be saved in an XML file for future reference or post-processing.

Using the tool

First of all, you need to configure the list of the web sites and of the IIS servers you need to inspect. To do this, on the main form, click on the "Web sites.." button. The "Web site Chooser" dialog box will appear:

Inside the "Web site Chooser" form, you can:

  • manually edit the list of the web sites you want to check, by entering the full metabase path of each of them;
  • automatically retrieve the web sites list, by clicking on the "Reload web sites list" button (the Virtual Directory Viewer will populate the list with all the web sites hosted on the servers specified in the "Server Chooser" - see below);
  • select/deselect the web sites to include in the actual virtual directory check.

The "Web site Chooser" form also allows simple query filtering and multiple selection/de-selection on the listed entries, to make the setup easier. The "Servers..." button lets you access the "Server Chooser" form, another configuration form (very similar to the previously described one) where you have to specify the web servers included in the virtual directory check.

This form offers similar filtering and selection facilities, but in the case of the web server list the editing is manual. The Virtual Directory Viewer uses two DataTable objects to hold both the list of the web servers and the list of the web sites to be inspected. (The latter eventually obtained by the former, as described.) These lists are automatically stored in an XML file to persist your working session environment.

After the setup of the web servers / web sites lists, run the automatic inspection of the virtual directory by clicking the "Load data" button on the main form. On the status bar, you will see the web site currently enumerated during the scan operation.

After the data collection, the resulting matrix - as already stated - can be read, sorted, transposed, exported in XML, copied to clipboard etc. (for pasting it, for example, in a Microsoft Excel sheet).

Points of interest

The core of the Virtual Directory Viewer tool uses the System.DirectoryServices .NET namespace to manage IIS metabase information. I have used the methods and properties of the DirectoryEntry class. Other points of interest include DataTable and DataSet manipulation and serialization.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Alberto Venditti
Technical Lead
Italy Italy
Member
I was born in 1970.
 
I studied Electronic Engineering (graduated in 1997).
 
Subsequently, I passed some Microsoft exams, and currently I'm certified as:
MCP, MCT, MCDBA, MCSD, MCAD, MCSD for .NET (early achiever).
 
My first computer experience dates back to early 80s, with a Sinclair ZX81.
From that time on, as many "friends" say, my IT-illness has increased year by year.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralThank You - Great Articlemembernospam1961-codeproject@yahoo.com25 Jul '08 - 7:34 
Great Job -- have been looking for the way to get a list of all of the web applications on multiple web server - Production, DR, etc. Your application is exactly what I needed -- the only thing is an output format which I will need to re-format to present in less scrollable form Smile | :)
 
Thanks again.
 
It can be done FAST, GOOD, and INEXPENSIVE. Please, choose any TWO.

GeneralReally Maintaining multiple IIS sites and servers (IIS 6 only)memberS E E B5 Sep '05 - 17:08 
Hi Alberto,
 
I don't have any complains but only praises to contribute. you see, after seeing your example I am now able to develop an in-house vb.Net Apps Deployment and Tracking System.
 
What I had in mind was to use your example in conjuction with adsutil.vbs, "adsutil.vbs enum_all" and iisback.vbs, sentmail through a series of command line scripts to facilitate the need to deploy apps to be used by an Network Administrator without needing Developer to access the Production environment.
 
Great work mate!
 
Cheers

 
Sebastian Dieu (sebastian.dieu@asc.com.au)
Generalpath valuememberAshley van Gerven8 Aug '05 - 21:53 
Interesting utility - well done. How come in the second column most of the path values are "c:\inetpub\wwwroot" and not e.g. "c:\inetpub\wwwroot\application" as expected? Since the vir-dir / application root is actually for example: "/application".
GeneralRe: path valuememberAlberto Venditti9 Aug '05 - 0:08 
Not sure I understood your question.
Have you got a screenshot of your IIS website configuration?
GeneralLOLmemberChristian Graus25 May '05 - 19:46 
This article contains no source code and no executable. It also doesn't include any discussion of how the code works, which makes it more of a 'tool' than an article.
 
However, it's had one vote, and the vote was for '5'. I guess people are still able to vote on their own articles Smile | :)
 
Christian Graus - Microsoft MVP - C++
GeneralRe: LOLmemberAlberto Venditti25 May '05 - 23:17 
I'm happy of being still able to induce good moods, it's a rare dowry nowadays...
Big Grin | :-D
Simply, there was an editing problem: the ZIP file containing the source code and the executable was not correclty linked to the article HTML text. Now, I hope it's okay.
I apologize for this initial inaccuracy and I thank you for your post.
 
About the content of the article: the code is fully commented, so I preferred to focus more on the "idea" and the "goal" of the tool than on its implementation, that is very simple and self-explaining (if not, please, let me know).
 
About voting articles, I confirm: an author is free to express his opinion on his own work by voting it one and only one time.
Now, tell me, please, honestly: don't you think that an author will publish only things he believes are "excellent", good and useful also for other people?
 
Cheers,
AV
GeneralRe: LOLmemberChristian Graus26 May '05 - 11:36 
*grin* I felt sure that the problem was just a missing link, given that your article obviously told people how to use the tool. Although I'm sure the code is well documented, I'd still have put some examples of points of interest in the article, if I wrote it.
 
And obviously you think your article is good, or you wouldn't post it. I was merely amused.

 
Christian Graus - Microsoft MVP - C++
QuestionSource Code !?memberShahrokh Shirzad25 May '05 - 19:32 
I suggest to add your sample source code to make your article more useful!Rose | [Rose]
AnswerRe: Source Code !?memberAlberto Venditti25 May '05 - 23:07 
The ZIP file containing the source code and the executable was not correclty linked to the article HTML text. Now, I hope it's okay.
I apologize for this initial inaccuracy.
Thank you for your notice.
AV
GeneralRe: Source Code !?memberJason Vetter24 Sep '06 - 5:57 
How about this thought:
Maybe add everything that is needed!
What a concept. Its missing the xml file.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 25 May 2005
Article Copyright 2005 by Alberto Venditti
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid