New IIS7 coded Admin Features

There will be several new ways of administrating IIS7 by using .NET with the upcoming IIS7 which is being delivered with Windows Vista.

The power and simplicity of the new API is just stunning at the moment. To use the new APIs in Windows Vista you just have to add a new Reference in Visual Studio Microsoft.Web.Administration.dll that can be found at IIS directory (%WinDir%\System32\InetSrv).

Creating a Site

ServerManager iisManager = new ServerManager();
iisManager.Sites.Add("NewSite", "http", "*:8080:", "d:\\MySite");
iisManager.Update();

This basically creates an instance of the ServerManager class and uses the Add method in the Sites collection to create a new site named “NewSite” listening at port 8080 using http protocol and content files are at d:\MySite.
One thing to note is that calling Update is a requirement since that is the moment when we persist the changes to the configuration store.
After running this code you have now a site that you can browse using http://localhost:8080

That’s just one little example of the cool new Admin Features in IIS7. That will make administration Softwares like PLESK a piece of cake.

You can get more example right here, at CarlosAg’s Blog.

1 comment so far ↓

#1 Travis on 08.08.07 at 6:27 am

Just another reason why Microsoft is so bad ass. People can hate all they want, but stuff like this just makes MS and IIS so freakin powerful. I wasnt even looking for this in my search, but had to comment on it.

Leave a Comment