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. NOJ1203 最多约数问题 [搜索 数论]

    传送门 njczy2010 1203 Accepted 79MS   1400K 2321Byte G++ 2015-01-25 13:14:25.0 最多约数问题 时间限制(普通/Java) : 2 ...

  2. 【Android】状态栏通知Notification、NotificationManager详解(转)

    在Android系统中,发一个状态栏通知还是很方便的.下面我们就来看一下,怎么发送状态栏通知,状态栏通知又有哪些参数可以设置? 首先,发送一个状态栏通知必须用到两个类:  NotificationMa ...

  3. T2038 香甜的黄油 codevs

    http://codevs.cn/problem/2038/ 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond   题目描述 Description 农夫John ...

  4. usaco feb04距离咨询

    [USACO FEB04]距离咨询 成绩   开启时间 2014年09月19日 星期五 10:08 折扣 0.8 折扣时间 2014年09月26日 星期五 10:08 允许迟交 是 关闭时间 2014 ...

  5. UVA11825 Hackers' Crackdown

    题目描述 PDF 输入输出格式 输入格式: 输出格式: 输入输出样例 输入样例#1: 3 2 1 2 2 0 2 2 0 1 4 1 1 1 0 1 3 1 2 0 输出样例#1: Case 1: 3 ...

  6. 实践与理解CMM体系

    我的项目管理之路--5.实践与理解CMM体系   分类: 管理专辑(65) 过程改进(9) 软件工程(52) 版权声明:本文为博主原创文章,未经博主允许不得转载. 一个现代企业我们可以把它比作为自然界 ...

  7. 谷歌訪问之直接输入ip地址

    废话啥说.直接上IP: 173.194.121.51 173.194.43.19 173.194.65.147 74.125.235.148

  8. Java 实现 淘宝秒杀 聚划算 自己主动提醒 源代码

    说明 本实例可以监控聚划算的抢购button,在聚划算整点聚的时间到达时自己主动弹开页面(URL自定义). 能够自己定义监控持续分钟数,同一时候还能够通过多线程加快刷新速度. 源代码 package ...

  9. antd 如何让 Row 中的 Col 自动换行?

    1.解决方案 在需要换行处,设置一个空的 Col // 空白(特殊情况处理) const empty = ( <Col md={6} sm={24}></Col> ); .

  10. 【C语言天天练(九)】动态内存分配

    引言:数组的元素存储于内存中连续的位置上.当一个数组被声明时.它所须要的内存在编译时就被分配. 可是,我们能够使用动态内存分配在执行时为它分配内存. 一块内存的生命周期能够分为四个阶段:分配.初始化. ...