471,310 Members | 1,057 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

DirectoryServices problem enumerating properties

I'm trying to write a custom installer for a web site project of mine
because the silly default WebInstaller projects don't know how to install
to anything other than the default web site... (if this is wrong, please
tell me!) So I'm trying to enumerate the web sites that exist on the local
machine with DirectoryServices:

DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC");

foreach(DirectoryEntry de in root.Children)
{
foreach(string pName in de.Properties.PropertyNames)
{
Console.WriteLine(
string.Format("{0} = {1}",
pName,
de.Properties[pName].Value
)
);
}
}

This works great on my development machine, but when I move to a machine
that I would actually install on (Small Business Server 2003), I get an
"NotSupportedException" with a message of "The directory cannot report the
number of properties".

Anyone know why I'm getting this exception? Anything I can do about it?
Is there any other way to reliably enumerate web sites?

-mdb
Feb 10 '06 #1
0 972

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Sean | last post: by
1 post views Thread by Stephanie Stowe | last post: by
5 posts views Thread by Keith Jakobs, MCP | last post: by
6 posts views Thread by bugnthecode | last post: by
5 posts views Thread by Peter Bradley | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.