Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IIS API

0 views
Skip to first unread message

Anonymous

unread,
Oct 10, 2008, 3:10:32 PM10/10/08
to
How do I programmatically list/enumerate the web sites in IIS from a c#
application?

I want to know which host headers each site responds to.
And I suppose there's other useful, per-site, info I also could use, total
size on disk, which framework they execute under, and such stuff.


bruce barker

unread,
Oct 10, 2008, 4:16:07 PM10/10/08
to
for iis 7.0 its IIS native code api:

http://msdn.microsoft.com/en-us/library/aa347613.aspx

for previous versions you use the iis com api:

http://msdn.microsoft.com/en-us/library/ms524505.aspx


-- bruce (sqlwork.com)


-- bruce (sqlwork.com)

Juan T. Llibre

unread,
Oct 11, 2008, 12:00:00 PM10/11/08
to
re:
!> How do I programmatically list/enumerate the web sites in IIS from a c# application?

Call a WScript from your C# app...

Set IISOBJ = getObject("IIS://LocalHost/W3SVC")
For each Object in IISOBJ
if (Object.Class = "IIsWebServer") then
WScript.Echo "WWW Site: " & Object.Name & " - " & Object.ServerComment
end if
next

For a "pure" C# script which does what you want to do, see :

http://www.iisfaq.com/Default.aspx?tabid=3166

You could also, if you only have ASP.NET websites, call :

aspnet_regiis -lk

That will list all ASP.NET websites on the server.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Anonymous" <bi...@microsoft.com> wrote in message news:OTdnfvwK...@TK2MSFTNGP04.phx.gbl...

0 new messages