You can't use the Microsoft.Web.Administration
namespace to configure and manage IIS6. Your options from a .NET perspective are System.DirectoryServices
, WMI or, if you're feeling really adventurous ABO (IIS Admin Base Objects).
In IIS7 you can use Microsoft.Web.Administration
and the other IIS7 Managed Code Administration libraries, in fact this is the preferred method because these components are fully aware of all of the new IIS7 features.
If you have some legacy code or tools that you don't have time to port, or can't (because you don't have access to the source), you can install the IIS6 compatibility components. These provide you with access to the old style ADSI API which System.DirectoryServices
and WMI wrap. In fact these also install the old ADSUTIL.vbs
script which is used to perform various management tasks on IIS6.
The IIS6 compatibility components on IIS7 simply wrap access to the IIS7 management libraries. They do a fairly good job, but are not aware of new management features that exist in IIS7 but not in IIS6.
So in a nutshell, in an ideal world you should continue to manage IIS6 using System.DirectoryServices
or WMI. For IIS7 your preference should be Microsoft.Web.Administration
and its friends.