https://stackoverflow.com/questions/2555668/how-to-programmatically-get-sites-list-and-virtual-dirs-in-iis-7

Check out this post - seems to be a brand-spanking new management API in the Microsoft.Web.Administration namespace:

http://blogs.msdn.com/carlosag/archive/2006/04/17/MicrosoftWebAdministration.aspx

Here's a quick graphical overview from that blog post:

And here's a "The Gu" post on Cool new IIS7 Features and APIs

Something like this will find all the sites, their application and their virtual directories in your IIS7 server:

  static void Main(string[] args)
{
ServerManager mgr = new ServerManager(); foreach(Site s in mgr.Sites)
{
Console.WriteLine("Site {0}", s.Name); foreach(Application app in s.Applications)
{
Console.WriteLine("\tApplication: {0}", app.Path); foreach(VirtualDirectory virtDir in app.VirtualDirectories)
{
Console.WriteLine("\t\tVirtual Dir: {0}", virtDir.Path);
}
}
} Console.ReadLine();
}

get all sites under IIS的更多相关文章

  1. ASP.NET IIS Registration Tool (Aspnet_regiis.exe)

    IIS Version Special cases for 32-bit versions of Aspnet_regiis.exe 6.0 You can run the 32-bit versio ...

  2. 使用 Microsoft.Web.Administration 管理iis

    How to Automate IIS 7 Configuration with .NET How to Automate IIS 7 Configuration with .NET Are you ...

  3. Debug your ASP.NET Application while Hosted on IIS

    转摘:http://www.codeproject.com/Articles/37182/Debug-your-ASP-NET-Application-while-Hosted-on-IIS This ...

  4. ASP.NET MVC 从零开始 - 请求处理

    这篇文章是从我的 github 博客 lxconan.github.io 导入的. 这是这个系列的第三篇了.前两篇文章请参见: ASP.NET MVC 从零开始 - Create and Run AS ...

  5. Web Servers in Visual Studio for ASP.NET Web Projects

    https://msdn.microsoft.com/en-us/library/58wxa9w5(v=vs.120).aspx When you develop web projects in Vi ...

  6. 检查.net代码中占用高内存函数(翻译)

    哈哈,昨天没事做,在CodeProject瞎逛,偶然看到这篇文章,居然读得懂,于是就翻译了一下,当练习英语,同时增强对文章的理解,发现再次翻译对于文章的一些细节问题又有更好的理解.下面是翻译内容,虽然 ...

  7. [引]ASP.NET MVC 4 Content Map

    本文转自:http://msdn.microsoft.com/en-us/library/gg416514(v=vs.108).aspx The Model-View-Controller (MVC) ...

  8. 转 HTTP/2: The Long-Awaited Sequel

    HTTP/2: The Long-Awaited Sequel Thursday, October 9, 2014 2:01 AM 6 Ready to speed things up? Here a ...

  9. Visual Studio中用于ASP.NET Web项目的Web服务器

    当您在 Visual Studio 中开发 Web 项目时,需要 Web 服务器才能测试或运行它们. 利用 Visual Studio,您可以使用不同的 Web 服务器进行测试,包括 IIS Expr ...

随机推荐

  1. EC++学习笔记(四) 设计与声明

    条款18:让接口容易被正确使用,不易被误用 必须考虑客户可能做出什么样的错误(防御式编程)std:shared_ptr会自动使用它的"每个指针专属的删除器",消除了"cr ...

  2. ZOJ 3811 / 2014 牡丹江赛区网络赛 C. Untrusted Patrol bfs/dfs/并查集

    Untrusted Patrol Time Limit: 3 Seconds                                     Memory Limit: 65536 KB    ...

  3. R语言入门视频笔记--6--R函数之cat、format、switch函数

    一.cat 猫  怎么就变成一个输出函数了呢? cat  一个输出函数,功能和print有相同之处 我们一起比较看看 1.cat(“hellow world”)或cat('hellow world') ...

  4. android调用 .net webService

    package com.rockcheck.mes; import android.os.AsyncTask; import android.support.v7.app.AppCompatActiv ...

  5. Java的常用对象

    PO:持久对象 (persistent object),po(persistent object)就是在Object/Relation Mapping框架中的Entity,po的每个属性基本上都对应数 ...

  6. 洛谷——P3576 [POI2014]MRO-Ant colony

    P3576 [POI2014]MRO-Ant colony 题目描述 The ants are scavenging an abandoned ant hill in search of food. ...

  7. CODEVS_1033 蚯蚓的游戏问题 网络流 最小费用流 拆点

    原题链接:http://codevs.cn/problem/1033/ 题目描述 Description 在一块梯形田地上,一群蚯蚓在做收集食物游戏.蚯蚓们把梯形田地上的食物堆积整理如下: a(1,1 ...

  8. [ZJOI 2018] 线图

    别想多了我怎么可能会正解呢2333,我只会30分暴力(好像现场拿30分已经不算少了2333,虽然我局的30分不是特别难想). 首先求k次转化的点数显然可以变成求k-1次转化之后的边数,所以我们可以先让 ...

  9. SpringBoot整合freemarker中自定义标签获取字典表的数据

    因为在前端要根据字典表中的数据去将1.2这些值转换成对应的文字解释 1.首先要创建一个类去实现 TemplateDirectiveModel 类 @Component public class Dic ...

  10. 【面试 springMVC】【第四篇】springMVC的一些问题

    1.springMVC的工作流程是什么样的 1.用户请求到达 2.DispatcherServlet接收请求,发送给处理器映射器 3.处理器映射器handlerMapping,处理找到对应处理器,返回 ...