Anyone know how to do this in C#?
It's pretty trivial in VB, but is being a PITA in C#. I can call the
Start/Stop methods w/o any problems, but I can't figure out how to read
the current status in C#?
Code looks like this:
DirectoryEntry obDirEntry = new DirectoryEntry
("IIS://localhost/W3svc/1");
obDirEntry.Invoke("Stop", new object[] {});
// Stop is not a synchronous call, so you have to poll status
I've tried this:
object status = obDirEntry.Invoke("Status", new object[] {});
object status = obDirEntry.Invoke("Get", new object[] {"Status"});
The first technique fails w/ no such method.
The 2nd technique fails with a cryptic HRESULT of 0x80005006 which is
undefined when I try to look it up w/ the error lookup tool :-P
The MSDN documentation claims that "Status" is a method:
http://msdn.microsoft.com/library/de...l=/library/en-
us/iissdk/html/1103907a-56ab-4b8d-84b6-5a73bd8532ef.asp
ken