站点标识

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

// Find unused ID value for new web site int siteID = 1;

//得到现有的站点标识

foreach (DirectoryEntry entry in root.Children)

  {

      if (entry.SchemaClassName == "IIsWebServer")

       {

        int ID = Convert.ToInt32(entry.Name);

        }

   }

原文地址:https://www.cnblogs.com/greencolor/p/1787778.html