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. Python脚本实现单据体背景色及字段前景色设置

    #PythonEntitySetColor clr.AddReference('Kingdee.BOS.Core') from Kingdee.BOS.Core.DynamicForm.PlugIn. ...

  2. 二分图最小覆盖的Konig定理及其证明,最小的覆盖证明

    [转http://www.cppblog.com/abilitytao/archive/2009/09/02/95147.html  ->  http://yejingx.ycool.com/p ...

  3. 线段树练习5(codevs 4927)

    题目描述 Description 有n个数和5种操作 add a b c:把区间[a,b]内的所有数都增加c set a b c:把区间[a,b]内的所有数都设为c sum a b:查询区间[a,b] ...

  4. gdbt原理解析

    链接: http://note.youdao.com/noteshare?id=aeb1c7a30c5f4b70e3fff51f28ee5c47 懒得复制到这里了,一开始是在有道云笔记上写的,这里的公 ...

  5. msp430项目编程37

    msp430中项目---usb接口编程37 1.电路工作原理 2.代码(显示部分) 3.代码(功能实现) 4.项目总结

  6. hdu3491最小割转最大流+拆点

    题意:求最小割,即求最大流即可.此题之关键为拆点(限制在点),每条边都是双向边,注意一下. 未1A原因:在拆点之后添加边的过程中,要注意,出去的是i`,进来的是i,!!所以,写addegde函数时候 ...

  7. Python种使用Excel

    今天用到Excel的相关操作,看了一些资料,借此为自己保存一些用法. 参考资料: python excel 的相关操作 python操作excel之xlrd python操作Excel读写--使用xl ...

  8. 关于SIP一些总结

    SIP(session Initiation protocol)会话初始协议,是应用层信令控制协议,主要应用于创建.修改.释放多媒体会话. 一般而言,SIP只负责不同UE之间的协商与通信,比如媒体能力 ...

  9. java中简单内存计算

    今天面试遇到一个问题,假设一个类中只声明一个int类型,那么这个对象多大,这里先写出解决方案,首先引入内存计算工具lucene-core, <dependency> <groupId ...

  10. NIO与传统IO的区别(形象比喻)[转]

    传统的socket IO中,需要为每个连接创建一个线程,当并发的连接数量非常巨大时,线程所占用的栈内存和CPU线程切换的开销将非常巨大.使用NIO,不再需要为每个线程创建单独的线程,可以用一个含有限数 ...