Click here to Skip to main content
15,886,199 members
Articles / Web Development / IIS
Article

ASP.NET IIS Chameleon Tool

Rate me:
Please Sign up or sign in to vote.
4.47/5 (8 votes)
15 Feb 20063 min read 71.6K   457   56   10
A tool to set one specific IIS Virtual Directory for a lot versions of the same web project.

IIS Chameleon

Introduction

The ASP.NET IIS Chameleon is a tool to set one specific IIS Virtual Directory for a lot versions of the same web project.

Background

Some web projects in our company, have at least two versions:

  • "internal" - An internal beta version, where the team builds new features.
  • "launched" - All the already launched versions of the same project.

Our developers team need to code/correct both versions, depending on the necessity. Therefore, we need to switch faster between all these versions. Now, we're working with both versions: VS2003 (.NET Framework 1.1) and VS2005 (.NET Framework 2.0). We have designed a structure for our development machines, that makes it easy to apply changes and manage our source code, linked with specific virtual directories. Take a look at the structure design:

Logic Structure Model

Challenge

Each developer needs to map, as soon as possible, a specific version of a project (this one could be a random physical directory) to its IIS Web Shared Directory, so our team can start the maintenance or new implementations.

Older Solution

Well, for each "version change process", a developer needs to check in all files, get the specific/target version, then run aspnet_regiis.exe* for the specific metabase path and for the specific .NET Framework version. Another solution is running the Internet Information Services (inetmgr.exe), and then change the physical directory for a specific virtual directory, and the ASP.NET version too.

Newer Solution

Basically, we build a Windows Forms application tool named IISChameleon to join and automate some aspnet_regiis.exe and inetmgr.exe tasks. This tool was built with VS2005 and runs over .NET Framework 2.0. Our team has Windows XP Professional and Internet Information Services 5.1.

How To Use

This tool will load a list of all the virtual directories in your machine; just select the entry, change all values you want, and click the Update button, and hands on.

How IISChameleon Works

We take advantages of the System.DirectoryServices.DirectoryEntry class from System.DirectoryServices.dll and the process aspnet_regiis.exe.

DirectoryEntry* Class

Before manipulating entries on IIS with the DirectoryEntry class, we need to know the basic ideas about how IIS manages these entries. Each IIS entry (web site, web virtual directory, FTP virtual directory, ...) has a schema name and a collection of properties. All entries follow a hierarchy, with parent entries and children entries. These hierarchies are defined by a metabase path, which means that every entry, similar to physical directories, has a path. A sample of this hierarchy can be viewed in the following picture (a shot of the Metabase Editor* tool):

Metabase Editor Tool

To instantiate a DirectoryEntry, we basically need its metabase path.

C#
DirectoryEntry directoryEntry = 
      new DirectoryEntry("IIS://localhost/w3svc/1/root");

The most of its properties should be accessed by indexers.

C#
Console.Write( directoryEntry.Properties["Path"].Value.ToString() );

ASP.NET IIS Registration Tool (aspnet_regiis.exe)

This is used to discover all ASP.NET versions in the current machine, and to register a version of ASP.NET for a specific virtual directory.

Definitions File

The definitions.xml is used to store information about all the runtimes installed. So, maybe you will edit this one.

XML
<runtimeVersions>
    <version alias="1.1"  baseDir="v1.1.4322"   full="1.1.4322.2032"/>
    <version alias="2.0"  baseDir="v2.0.50727"  full="2.0.50727.0"/>
</runtimeVersions>

IISChameleon User Interface

To build the user interface, we use some native controls coming from .NET Framework 2.0 and a simple JPGrid*.

Conclusion

IISChameleon, when combined with a standard structure of directories and versions, could be usual for developer teams, and support teams too.

References

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


Written By
Web Developer BENNER SISTEMAS
Brazil Brazil
im just a developer,..

Comments and Discussions

 
Generalfind Dot net version installed in system Pin
mjavid6225-May-07 21:54
mjavid6225-May-07 21:54 
GeneralAspNetIsInstalled always return false Pin
Michael Freidgeim16-Aug-06 20:58
Michael Freidgeim16-Aug-06 20:58 
GeneralUseful to be called from Web Setup Pin
Michael Freidgeim10-May-06 19:27
Michael Freidgeim10-May-06 19:27 
GeneralVery nice!!! Pin
Friedrich Brunzema8-Mar-06 11:07
Friedrich Brunzema8-Mar-06 11:07 
JokeBoa idéia Pin
Patrick Antonioli Ferraro16-Feb-06 4:15
Patrick Antonioli Ferraro16-Feb-06 4:15 
GeneralExcellent Utility Pin
Michael McKechney3-Jan-06 15:50
Michael McKechney3-Jan-06 15:50 
GeneralDo you mean &quot;Chameleon&quot; Pin
Peter Ritchie29-Dec-05 10:08
Peter Ritchie29-Dec-05 10:08 
AnswerRe: Do you mean &quot;Chameleon&quot; Pin
joaoPaulo24-Jan-06 23:52
joaoPaulo24-Jan-06 23:52 
GeneralNeat Idea! Pin
mrchief_200028-Dec-05 4:26
mrchief_200028-Dec-05 4:26 
AnswerRe: Neat Idea! Pin
joaoPaulo25-Jan-06 0:00
joaoPaulo25-Jan-06 0:00 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.