IIS API

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anonymous

    #1

    IIS API

    How do I programmaticall y 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.


  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: IIS API

    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)


    "Anonymous" wrote:
    How do I programmaticall y 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.
    >
    >
    >

    Comment

    • Juan T. Llibre

      #3
      Re: IIS API

      re:
      !How do I programmaticall y 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 = "IIsWebServ er") then
      WScript.Echo "WWW Site: " & Object.Name & " - " & Object.ServerCo mment
      end if
      next

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

      This website is for sale! iisfaq.com is your first and best source for all of the information you’re looking for. From general topics to more of what you would expect to find here, iisfaq.com has it all. We hope you find what you are searching for!


      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" <billg@microsof t.comwrote in message news:OTdnfvwKJH A.5328@TK2MSFTN GP04.phx.gbl...
      How do I programmaticall y 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.
      >
      >

      Comment

      Working...