简体   繁体   中英

IIS7.5 GetHostNamesPerSite using C#

List<string> GetHostNamesPerSite(string SiteName)

如何在C#中使用IIS来GetHostNamesPerSite?

If you mean get a list of all of the host header host names bound to a site:

public static List<string> GetHostNamesPerSite(string siteName)
{
  using (ServerManager sm = new ServerManager())
  {
    Site site = sm.Sites.First(s => s.Name == siteName);
    return site.Bindings.Select(s => s.Host).ToList();
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM