What’s the Provware Framework?
The Provware Framework is an API set built to make the interactions with IIS more intuitive and developer friendly. For instance, the typical way that developers interact with IIS is via the DirectoryServices API of the .NET Framework. This requires a fair amount of knowledge of how to program via ADSI and the IIS Metabase. Since many people are just looking for a way to create sites, virtual directories, and application pools, this can be very difficult. Thus the Provware Framework is born. The Provware Framework provides a simple way to manage IIS components via .NET in a more “strongly typed” fashion.
There are two core namespaces in the Provware Framework: Provware.Framework.IIS and Provware.Framework.Web.
Provware.Framework.IIS
This namespace provides the core abstraction of the DirectoryEntry object via the Provware Framework. The main class in this namespace is the “IISManager” class. The IISManager class is responsible for populating a given “IIS Class”.
The following code example shows how to use the IISManager to populate an IIsWebServer class and then display all of the “Server Bindings” for the site in the console.
IISManager iism = new IISManager();
IIsWebServer myWeb = iism.GetIIsWebServer(“IIS://Localhost/w3svc/1”);
foreach (string bind in myWeb.ServerBindings)
{
Console.WriteLine(bind);
}
As you can see, binding to the site is pretty much the same via the IISManager as it is with the DirectoryEntry class, but the call to the “ServerBindings” property is done via a property name of the class and not through a property bag (e.g. DirectoryEntryObject.Properties[“ServerBindings”]). The advantage of doing it through a property is that you don’t have to guess what the write property name actually is or how it behaves (Boolean, Integer, String, or List). The Provware Framework, and the Intellisense Support in Visual Studio, gives you the entire list during coding.

Provware.Framework.Web
This namespace goes much further in abstracting out the complexities of programming against IIS. The overall goals of this namespace is to think more of IIS as a collection of sites and servers and interact with them as you would any other type of collection.
The main entry point is the “WebManager” class. It’s responsible for first “loading” the initial metabase objects (ApplicationPools and Sites) in the “WebServer” class of the framework.
Here are some examples.
Bind to a given Web Server
WebManager wm = new WebManager();
WebServer iisServer = wm.Connect(“Localhost”);
Add new binding to the Default Site. The Site Object is the core object, but all of the properties for this site are found by calling the IIsWebServer property. This will return the IIsWebServer class which is based on the “Provware.Framework.IIS” namespace.
Site defaultSite = iisServer.Sites[“Default Website”];
defaultSite.IIsWebServer.ServerBindings.Add(“:8080:”);
Create a new site – This call will take in the Site Name (aka ServerComment), initial Binding, content path, boolean if the content path should be created if it doesn’t exist.
Site newSite = iisServer.CreateSite(“MySite”, “:80:www.mysite.com”,”C:\\Sites\\mySite\\Content\\Web”, true”);
Get a DataTable of all the Sites for a given IIS Server – With the DataTable, it will make it much easier to display this information in a DataGrid or DataView in ASP.NET or a Windows Forms application.
ArrayList returnList = new ArrayList();
returnList.Add(“ServerComment”);
returnList.Add(“ServerState”);
returnList.Add(“ServerBindings”);
DataTable props = iisServer.Sites.GetDataTableDetailed(returnList);
Since this is the first build, all of the core features, error handling, or documentation are not anywhere complete. I’m jazzed to at least have this first build and I’m very interested in getting a lot of feedback from my fellow .NET and IIS developer community friends so that I can improve on this class. Performance of the class is a bit slow right now, but it will improve as the builds move forward. I’m still bound to the performance issues involved in communicating with the IIS Metabase, but perhaps the benefits of the Provware Framework will make it worth the hit.
I plan on making the source of this project available as well in the near future.
There is a website/portal that comes with the Provware Framework download. It’s not currently meant to be anything more than a sample of how to interact with the Framework, but I’m thinking of giving it more of a web based IIS Manager MMC/IIS Metabase Explorer type of life. No plans are set in stone yet.
Bonus Material: Provware IIS Class Builder
In developing the Provware.Framework.IIS classes, I needed a way to build a C# class that had all of the same properties of a given IIS Metabase Class (e.g. IIsWebServer). To do this, I wrote a program called the “Provware IIS Class Buider”. It’s goal is to bind to an IIS site, get all of the properties available for a given IIS Metabase Class, and then dynamically build a C# class that contained a public property name (and correctly typed…string, boolean, Int32, and List) for each IIS Metabase property assigned to that IIS Metabase class type. It was a lot of fun figuring this out. Once I got the mechanics down, it worked for all IIS Metabase classes. Once you have all of the classes “built”, they are pretty much just empty shells. If you have the desire to leverage this in your project, go for it. These shell classes are a core part of the Provware.Framework.IIS namespace.
The first version of this is available with the source in the below location.