<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>CarlosAg Blog : .NET</title><link>http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx</link><description>Tags: .NET</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Microsoft Web Platform Installer Beta Released</title><link>http://blogs.msdn.com/carlosag/archive/2008/10/02/WebPIBetaReleased.aspx</link><pubDate>Thu, 02 Oct 2008 14:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8974090</guid><dc:creator>CarlosAg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8974090.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8974090</wfw:commentRss><description>&lt;P&gt;Today we are releasing a new Web Site at &lt;A title=http://www.microsoft.com/web/ href="http://www.microsoft.com/web/" mce_href="http://www.microsoft.com/web/"&gt;http://www.microsoft.com/web/&lt;/A&gt; where users can get a one stop shop for learning about the Microsoft Web Platform. This is part of a bigger effort to make it easier to get started with building and running Web Applications on Windows and IIS. &lt;/P&gt;
&lt;P&gt;As part of this a new tool called the &lt;STRONG&gt;Web Platform Installer&lt;/STRONG&gt; Beta is also being released to help you getting started installing and getting all the software that you need from a single place without having to hunt around for installers, links or anything else. Just launch the tool, choose the software and configuration you are interested and it takes care of validating and installing pre-requisites.&lt;/P&gt;
&lt;P&gt;This tool will let you easily setup your development machines for building Web Applications quite nicely, it will also help you discover new tools, applications, features and beta's as they are getting released from several sources including IIS, ASP.NET and Visual Web Developer and more as we continually make new software available through updates to the feed that the tool consumes.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Download page: &lt;A title=http://www.microsoft.com/web/channel/products/WebPlatformInstaller.aspx href="http://www.microsoft.com/web/channel/products/WebPlatformInstaller.aspx" mce_href="http://www.microsoft.com/web/channel/products/WebPlatformInstaller.aspx"&gt;http://www.microsoft.com/web/channel/products/WebPlatformInstaller.aspx&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Link to Run it: &lt;A title=http://go.microsoft.com/?linkid=9588072 href="http://go.microsoft.com/?linkid=9588072" mce_href="http://go.microsoft.com/?linkid=9588072"&gt;http://go.microsoft.com/?linkid=9588072&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Here are a few snapshots of the tool:&lt;/P&gt;
&lt;P&gt;This is the start page where you can choose to install everything available or customize the installation (Your Choice).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image.png" mce_href="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=301 alt="WebPI Start Page" src="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_thumb.png" width=404 border=0 mce_src="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;In this page you can customize the selection and browse around all the current list of products and check and uncheck any product you want to install.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_3.png" mce_href="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_3.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=301 alt=image src="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_thumb_3.png" width=404 border=0 mce_src="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;There are a couple of more pages, and finally the progress where the tool downloads any files required and install them, so that you can at once get the whole Web Platform installed easily.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_4.png" mce_href="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_4.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=301 alt=image src="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_thumb_4.png" width=404 border=0 mce_src="http://www.carlosag.net/images/MicrosoftWebPlatformandtheWebPlatformIns_103F5/image_thumb_4.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Some of the products and features that the Beta supports installing and configuring include:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;IIS (Ability to granularly configure each of the features of IIS)&lt;/LI&gt;
&lt;LI&gt;IIS Extensions (such as the Out-of-band releases that we have made available in &lt;A href="http://www.iis.net/" mce_href="http://www.iis.net"&gt;http://www.iis.net&lt;/A&gt; including &lt;STRONG&gt;Bit Rate Throttling, Web Playlist, Microsoft Web Deployment, FTP 7.0 Server, URL Rewrite, and more)&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;.NET Framework 3.5&lt;/LI&gt;
&lt;LI&gt;SQL Express 2008&lt;/LI&gt;
&lt;LI&gt;SQL Server Driver for PHP&lt;/LI&gt;
&lt;LI&gt;Visual Web Developer 2008 Express &lt;/LI&gt;
&lt;LI&gt;Windows Installer 4.5&lt;/LI&gt;
&lt;LI&gt;more&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;So as you can see everything you need to build Web Applications, from a Web Server (IIS), to a Development tool (Visual Web Developer) to a Database (SQL Server Express) and many more all for free.&lt;/P&gt;
&lt;P&gt;So go ahead and try the tool, give us feedback (&lt;STRONG&gt;remember this is a Beta) &lt;/STRONG&gt;so it can only get better :)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8974090" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Adding ASP.NET Tracing to IIS 7.0 Failed Request Tracing</title><link>http://blogs.msdn.com/carlosag/archive/2008/07/04/AddingAspNetTracingToIIS70FREB.aspx</link><pubDate>Fri, 04 Jul 2008 18:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8691622</guid><dc:creator>CarlosAg</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8691622.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8691622</wfw:commentRss><description>&lt;P&gt;IIS 7.0 Failed Request Tracing (for historical reasons internally we refer to it as FREB, since it used to be called Failed Request Event Buffering, and there are no "good-sounding-decent" acronyms for the new name) is probably the best diagnosing tool that IIS has ever had (that doesn't require Debugging skills), in a simplistic way it exposes all the interesting events that happen during the request processing in a way that allows you to really understand what went wrong with any request. To learn more you can go to &lt;A title=http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis7/ href="http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis7/" mce_href="http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis7/"&gt;http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis7/&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;What is not immediately obvious is that you can use this tracing capabilities from your ASP.NET applications to output the tracing information in our infrastructure so that your users get a holistic view of the request. &lt;/P&gt;
&lt;P&gt;When you are developing in ASP.NET there are typically two Tracing infrastructures you are likely to use, the ASP.NET Page Tracing and the System.Diagnostics Tracing. In recent versions they have been better integrated (attribute writeToDiagnosticsTrace)&amp;nbsp; but still you want to know about both of them.&lt;/P&gt;
&lt;P&gt;Today I'll just focus on logging ASP.NET Tracing to FREB, and in a future post I will show how to do it for System.Diagnostics Tracing.&lt;/P&gt;
&lt;P&gt;To send the ASP.NET Tracing to FREB you just need to enable ASP.NET tracing, use the ASPNET trace provider and you will get those entries in the FREB log. The following web.config will enable FREB and ASP.NET Tracing. (Note that you need to go to the Default Web Site and Enable Failed Request Filtering so that this rules get executed)&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;?xml&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; version&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="1.0"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; encoding&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="UTF-8"?&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;configuration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.web&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;trace&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; enabled&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="true"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; pageOutput&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="false"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.web&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;tracing&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;traceFailedRequests&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;add&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; path&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="*.aspx"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;traceAreas&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;add&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; provider&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="ASPNET"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; areas&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Infrastructure,Module,Page,AppServices"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; verbosity&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Verbose"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;add&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; provider&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="WWW Server"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; areas&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Authentication,Security,Filter,StaticFile,Compression,Cache,RequestNotifications,Module,Rewrite"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; verbosity&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Verbose"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;traceAreas&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;failureDefinitions&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; statusCodes&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="100-600"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;add&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;traceFailedRequests&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;tracing&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;configuration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;Now if you have a sample page like the following:&lt;/P&gt;
&lt;DIV class=code&gt;&lt;SPAN style="BACKGROUND-COLOR: #ffff99"&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;%@&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Page Language&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="C#"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; %&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;script&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; runat&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="server"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Page_Load()&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Page&lt;/FONT&gt;&lt;FONT color=#000000&gt;.Trace.Write(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Hello world from my ASP.NET Application"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Page&lt;/FONT&gt;&lt;FONT color=#000000&gt;.Trace.Warn(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"This is a warning from my ASP.NET Application"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;script&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;html&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://www.w3.org/1999/xhtml"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;head&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; runat&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="server"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;title&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Untitled Page&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;title&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;head&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;body&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;form&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; id&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="form1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; runat&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="server"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;div&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;div&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;form&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;body&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;html&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;The result is that in \inetpub\logs\FailedReqLogsFiles\ you will get an XML file that includes all the details of the request including the Page Traces from ASP.NET. Note that we provide an XSLT transformation that parses the Xml file and provides a friendly view of it where it shows different views of the trace file. For example below only the warning is shown in the Request Summary view:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput1.jpg" mce_href="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput1.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=308 alt=TraceOutput1 src="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput1_thumb.jpg" width=403 border=0 mce_src="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput1_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;There is also a Request Details view where you can filter by all the ASP.NET Page Traces that includes both of the traces we added in the Page code.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput2.jpg" mce_href="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=309 alt=TraceOutput2 src="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput2_thumb.jpg" width=405 border=0 mce_src="http://www.carlosag.net/images/AddingASP.NETTraci.0FailedRequestTracing_DC35/TraceOutput2_thumb.jpg"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8691622" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>IIS 7.0 Talk at ASP.NET Connections at Orlando</title><link>http://blogs.msdn.com/carlosag/archive/2008/04/28/IISTalkAtAspnetConnections.aspx</link><pubDate>Mon, 28 Apr 2008 15:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8436016</guid><dc:creator>CarlosAg</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8436016.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8436016</wfw:commentRss><description>&lt;P&gt;Last Monday I gave a presentation at the &lt;A href="http://www.asp-connections.com/shows/SP2008ASP/" mce_href="http://www.asp-connections.com/shows/SP2008ASP/"&gt;ASP.NET Connections&lt;/A&gt; event in Orlando, the title was &lt;STRONG&gt;IIS 7.0 for ASP.NET Developers&lt;/STRONG&gt;. I just wish I had more time to stay at Orlando, weather was great, especially considering that Sunday I was watching Snow in Redmond and then Monday and Tuesday I was around 80 degrees in sunny Orlando.&lt;/P&gt;
&lt;P&gt;Anyway, thanks for all the people who attended the session, you can download the &lt;/P&gt;&lt;A href="http://www.carlosag.net/downloads/IIS7ASPNETConnections.zip" target=_blank mce_href="http://www.carlosag.net/downloads/IIS7ASPNETConnections.zip"&gt;Slides and the Demos from here.&lt;/A&gt; 
&lt;P&gt;Here are some of the things that I demonstrated:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;First Demo: ApplicationHost.config, Web.config and Tools.&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;Showed the Application Pools list and how Visual Studio 2008 now provides IntelliSense for all the configuration of IIS. &lt;/LI&gt;
&lt;LI&gt;Added a new Application Pool using Notepad, and IIS Manager shows it. &lt;/LI&gt;
&lt;LI&gt;Showed the Sites section and created a new /Temp Application to my c:\temp directory. &lt;/LI&gt;
&lt;LI&gt;Browsed to the application and showed the new detailed error messages that IIS7.0 includes giving you all the details on what&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the problem is, and suggestions on how to fix it. &lt;/LI&gt;
&lt;LI&gt;Created a new Web.config where I enabled system.webServer/directoryBrowse and showed how this immediately applied the changes. &lt;/LI&gt;
&lt;LI&gt;Showed all the new tools that IIS includes for managing web.config, including IIS Manager, AppCmd, Javascript, and the new Configuration Editor included in IIS Admin Pack that will allow you&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to generate scripts for all of them. &lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;Second Demo: Pipeline Mode and Application Migration&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;Showed the Application Pools created by IIS, explained some of the differences in Classic Mode versus Integrated Mode. &lt;/LI&gt;
&lt;LI&gt;Showed how to create a new Application Pool and where to specifythe pipeline modes. &lt;/LI&gt;
&lt;LI&gt;Downloaded BlogEngine.net and created an application for it running in Integrated Mode. Showed the detailed errors when IIS detects compatibility issues with the pipeline mode and settings&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; like &amp;lt;httpModules/httpHandlers&amp;gt;. &lt;/LI&gt;
&lt;LI&gt;Showed how assigning it to a Classic Mode immediately makes it run in the same way as before. &lt;/LI&gt;
&lt;LI&gt;Then moved it back to Integrated Mode, and showed how to use AppCmd to migrate config (appcmd migrate config "path"), and showed&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the changes between the original web.config and the updated one. &lt;/LI&gt;
&lt;LI&gt;Explained these differences and how this is the right way to create applications that will run in IIS6, IIS7 classic mode and&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IIS7 integrated mode &lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;Third Demo: Leveraging the Integrated Pipeline&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;Showed a typical application that was configured using Forms Authentication and ASP.NET Membership and how accessing other content than ASP.NET (i.e. text files, images, classic ASP etc) would not cause authentication to happen. &lt;/LI&gt;
&lt;LI&gt;Showed how easy just by changing the FormsAuthentication module and the UrlAuthorization module you were able to easily now authenticate all the requests, including Classic ASP, PHP, static files, etc. &lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;Fourth Demo: Output Caching&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;Showed a little performance script using WCAT running against the BlogEngine.net in my laptop (running Windows Vista) gave around 400 requests per second, and made W3WP.exe take about a 100% of CPU, meaning it couldn’t do anything more. &lt;/LI&gt;
&lt;LI&gt;Enabled Output Caching using IIS Manager for .aspx pages. &lt;/LI&gt;
&lt;LI&gt;Ran the Stress Test again, and this occasion the results were that we got around 1000 requests per second, but more importantly CPU consumed by W3WP.exe was only around 20%. The Stress client was the one taking all the CPU, meaning that the server could easily do more than twice as many request per second if the stress client was done by another machine. &lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;Fifth demo: Extensibility&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;Showed how easy it is to extend IIS using Managed code, building a Handler that would translate PNG images to Jpeg images as well as embed a copyright information all dynamically at runtime. &lt;/LI&gt;
&lt;LI&gt;Showed another simple example on how to extend using a Module that logged every request to a SQL Server database. &lt;/LI&gt;&lt;/OL&gt;&lt;/OL&gt;
&lt;P&gt;Then I ran out of time :) &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8436016" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Not getting IntelliSense in your web.config for system.webServer sections in Visual Studio 2008?</title><link>http://blogs.msdn.com/carlosag/archive/2008/04/20/IntellisenseInYourWebConfigIISSectionsInVisualStudio2008.aspx</link><pubDate>Sun, 20 Apr 2008 03:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8410624</guid><dc:creator>CarlosAg</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8410624.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8410624</wfw:commentRss><description>&lt;P&gt;Today I was playing a bit with Visual Studio 2008 and was surprised to see that I was not getting IntelliSense in my web.config. As you might already know IntelliSense in Xml in Visual Studio is implemented by using a set of schemas that are stored in a folder inside the VS folder, something like: \Program Files\Microsoft Visual Studio 9.0\Xml\Schemas. After looking to the files it was easy to understand what was going on, turns out I was developing using .NET 2.0 settings and Visual Studio now ships different schemas for Web.config files depending on the settings that you are using: &lt;STRONG&gt;DotNetConfig.xsd, DotNetConfig20.xsd and DotNetConfig30.xsd&lt;/STRONG&gt;. &lt;/P&gt;
&lt;P&gt;As I imagine I looked into the DotNetConfig.xsd and it indeed has all the definitions for the system.webServer sections as well as the DotNetConfig30.xsd. However, &lt;STRONG&gt;DotNetConfig20.xsd does not include the section &lt;/STRONG&gt;details, only its definition, so &lt;STRONG&gt;to fix your IntelliSense &lt;/STRONG&gt;you can just open DotNetConfig.xsd, select the entire section from:&lt;/P&gt;
&lt;P&gt;&amp;lt;xs:element name="system.webServer" vs:help="configuration/system.webServer"&amp;gt;...&amp;lt;/xs:element&amp;gt;&lt;/P&gt;
&lt;P&gt;and just replace the entry in DotNetConfig20.xsd. You might also want to copy the system.applicationHost section and add it to the DotNetConfig20.xsd since it does not include it as well.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8410624" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>How to register a new Section Definition using Microsoft.Web.Administration</title><link>http://blogs.msdn.com/carlosag/archive/2008/04/15/HowToRegisterSectionsUsingMicrosoftWebAdministration.aspx</link><pubDate>Tue, 15 Apr 2008 15:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8398157</guid><dc:creator>CarlosAg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8398157.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8398157</wfw:commentRss><description>&lt;P&gt;Today I was asked how can someone would be able to add a new section definition using Microsoft.Web.Administration, so I thought I would post something quickly here just to show how this could be achieved.&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;System&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Microsoft.Web.Administration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;class&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Program&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;static&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Main(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#000000&gt;[]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;args)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ServerManager&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;m&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ServerManager&lt;/FONT&gt;&lt;FONT color=#000000&gt;())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Configuration&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;config&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;m.GetApplicationHostConfiguration()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;SectionDefinition&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;definition&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;RegisterSectionDefinition(config,&lt;/FONT&gt;&lt;FONT color=#808080&gt; "system.webServer/mySubgroup/mySection"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;definition.OverrideModeDefault&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "Allow"&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;m.CommitChanges()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;public&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;static&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;SectionDefinition&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;RegisterSectionDefinition(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Configuration&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;config,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;sectionPath)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#000000&gt;[]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;paths&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;sectionPath.Split(&lt;/FONT&gt;&lt;FONT color=#808080&gt;'/'&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;SectionGroup&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;group&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;config.RootSectionGroup&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;for&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;i&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;0&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;i&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;paths.Length&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;-&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;i++)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;SectionGroup&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;newGroup&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;group.SectionGroups[paths[i]]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;if&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(newGroup&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;==&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;newGroup&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;group.SectionGroups.Add(paths[i])&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;group&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;newGroup&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;SectionDefinition&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;section&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;group.Sections[paths[paths.Length&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;-&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;]]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;if&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(section&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;==&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;section&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;group.Sections.Add(paths[paths.Length&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;-&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#000000&gt;])&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;section&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;The idea is that you can grab a Configuration object they usual way, it could be ApplicationHost.config or any web.config, and then you call the method RegisterSectionDefinition which will ensure the whole hierarchy is added (in the case of multiple nested Section Groups) and then it will return the newly added Section Definition that you can then use to change any of their properties.&lt;/P&gt;
&lt;P&gt;A very similar functionality is exposed for scripts and native code in the AHADMIN COM library exposing the RootSectionGroup as well from any IAppHostConfigFile that you can manipulate in the same way.&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8398157" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/Microsoft.Web.Administration/default.aspx">Microsoft.Web.Administration</category></item><item><title>Host your own Web Server in your application using IIS 7.0 Hostable Web Core</title><link>http://blogs.msdn.com/carlosag/archive/2008/04/14/HostYourOwnWebServerUsingIIS7.aspx</link><pubDate>Mon, 14 Apr 2008 11:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8386330</guid><dc:creator>CarlosAg</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8386330.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8386330</wfw:commentRss><description>&lt;P&gt;IIS 7.0 includes a very cool feature that is not so well known called Hostable WebCore (HWC). This feature basically allows you to host the entire IIS functionality within your own process. This gives you the power to implement scenarios where you can customize entirely the functionality that you want "your Web Server" to expose, as well as control the lifetime of it without impacting any other application running on the site. This provides a very nice model for automating tests that need to run inside IIS in a more controlled environment.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This feature is implemented in a DLL called hwebcore.dll, that exports two simple methods:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;WebCoreActivate&lt;/STRONG&gt;. This method allows you to start the server. It receives three arguments, out of which the most important one is applicationHostConfigPath that allows you to point it to your very own copy of ApplicationHost.config where you can customize the list of modules, the list of handlers and any other settings that you want your "in-proccess-IIS" to use. Just as ApplicationHost.config you can also specify the "root web.config" that you want your server to use, giving you the ability to completely run an isolated copy of IIS. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;WebCoreShutdown&lt;/STRONG&gt;. This method basically stops the server listening. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The real trick for this feature is to know exactly what you want to support and "craft" the IIS Server configuration needed for different workloads and scenarios, for example:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Static Files Web Server - Supporting only static file downloads, good for HTML scenarios and other simple sites. &lt;/LI&gt;
&lt;LI&gt;Dynamic Web Sites 
&lt;OL&gt;
&lt;LI&gt;ASPX Pages &lt;/LI&gt;
&lt;LI&gt;WCF &lt;/LI&gt;
&lt;LI&gt;Custom set of Http Modules and Handlers &lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;
&lt;LI&gt;All of the above &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;An interesting thing to mention is that the file passed to ApplicationHostConfigPath parameter is live, in the sense that if you change the configuration settings your "in-process-IIS" will pick up the changes and apply them as you would expect to. In fact even web.config's in the site content or folder directories will be live and you'll get the same behavior.&lt;/P&gt;
&lt;H2&gt;Sample&lt;/H2&gt;
&lt;P&gt;To show how easy this can be done I wrote a small simple class to be able to run it easily from managed code. To consume this, you just have to do something like:&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=#0000ff&gt;internal&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;class&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Program&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;private&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;static&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Main(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#000000&gt;[]&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;args)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;port&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;54321&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;siteId&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000&gt;1&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;WebServer&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;server&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;WebServer(&lt;/FONT&gt;&lt;FONT color=#808080&gt;@"d:\Site"&lt;/FONT&gt;&lt;FONT color=#000000&gt;,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;port,&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;siteId)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;server.Start()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Server Started!... Press Enter to Shutdown"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.ReadLine()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Shutting down"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;server.Stop()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;This will start your very own "copy" of IIS running in your own process, this means that you can control which features are available as well as the site and applications inside it without messing with the local state of the machine.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;A very interesting thing is that it will even run without administrator privileges&lt;/STRONG&gt;, meaning any user in the machine can start this program and have a "web server" of their own, that they can recycle, start and stop at their own will. (Note that this non-administrative feature requires Vista SP1 or Windows Server 2008, and it only works if the binding will be a local binding, meaning no request from outside the machine).&lt;/P&gt;
&lt;P&gt;You can download the entire sample which includes two configurations: 1) one that runs only an anonymous static file web server that can only download HTML and other static files, and 2) one that is able to run ASP.NET pages as well.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;A href="http://www.carlosag.net/downloads/HWCServer.zip" target=_blank mce_href="http://www.carlosag.net/downloads/HWCServer.zip"&gt;&lt;STRONG&gt;Download the entire sample source code&lt;/STRONG&gt;&lt;/A&gt; (9 kb)&lt;/P&gt;
&lt;P&gt;You might be asking &lt;STRONG&gt;why would I even care&lt;/STRONG&gt; to have my own IIS in my executable and not just use the real one? Well there are several scenarios for this:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Probably one of the most useful, as mentioned above this actually allows non-administrators to be able to develop applications that they can debug, change configuration and pretty much do anything without interfering with the machine state. &lt;/LI&gt;
&lt;LI&gt;Another scenario might include something like a "Demo/Trial CD" where you can package your application in a CD/DVD that users then can insert in their machine and suddenly get a running/live demo of your Web Application without requiring them to install anything or define new applications in their real Web Server.&lt;/LI&gt;
&lt;LI&gt;Test Driven Development. Testing in the real Web Server tends to interfere with the machine state which is by definition something you don't want in your test environments, ideally you want your tests to be done in an isolated environment that is fully under control and that you will not have to do any manual configuration. This makes this feature an ideal candidate for such scenario where you own the configuration and can "hard-code" it as part of your automated tests. No more code for "preparing the server and site", everything starts pre-configured.&lt;/LI&gt;
&lt;LI&gt;Build your own service. You can build your own service and use Hostable WebCore as a simple yet powerful alternative to things like HttpListener, where you will be able to execute Managed and Native code Http Modules and Handlers easily without you having to do any custom hosting for ASP.NET infrastructure.&lt;/LI&gt;
&lt;LI&gt;Have your own Development Web Server where you can have advance interaction between both the client and the server and trace and provide live debugging information.&lt;/LI&gt;
&lt;LI&gt;many, many more...&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;In future posts I intent to share more samples that showcase some of this cool stuff.&lt;/P&gt;
&lt;H2&gt;Summary&lt;/H2&gt;
&lt;P&gt;IIS 7.0 Hostable WebCore feature allows you to host a "copy" of IIS in your own process. This is not your average "HttpListener" kind of solution where you will need to implement all the functionality for File downloads, Basic/Windows/Anonymous Authentication, Caching, Cgi, ASP, ASP.NET, Web Services, or anything else you need; Hostable WebCore will allow you to configure and extend in almost any way the functionality of your own Web Server without having to build any code.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8386330" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>IIS Admin Pack: Configuration Editor</title><link>http://blogs.msdn.com/carlosag/archive/2008/03/31/IISAdminPackConfigurationEditor.aspx</link><pubDate>Mon, 31 Mar 2008 11:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8343863</guid><dc:creator>CarlosAg</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8343863.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8343863</wfw:commentRss><description>&lt;P&gt;Today I will be talking about one of the features included in the new &lt;A href="http://blogs.msdn.com/carlosag/archive/2008/03/21/IISAdminPackTP1Released.aspx" target=_blank mce_href="http://blogs.msdn.com/carlosag/archive/2008/03/21/IISAdminPackTP1Released.aspx"&gt;IIS Admin Pack&lt;/A&gt; called Configuration Editor.&lt;/P&gt;
&lt;P&gt;Configuration Editor is an IIS Manager feature that will let you managed any configuration section available in your configuration system. Configuration Editor exposes several features from configuration that are not exposed anywhere else in IIS Manager, including:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Schema Driven - Config Editor is entirely driven by the configuration schema (found in \windows\system32\inetsrv\config\schema\), this means that if you extend the configuration system creating your sections, they will be available for managing inside config editor, no need to build additional UI for them. &lt;/LI&gt;
&lt;LI&gt;Additional Information - Config Editor exposes more information such as the deepest place where the section is being used, or where a particular element in a collection is coming from (where is it inherited from?), etc. &lt;/LI&gt;
&lt;LI&gt;Script Generation - Allows you to make changes and it generates the code to automate those tasks, generating Managed Code (using Microsoft.Web.Administration), JavaScript (using AHADMIN) or Command Line (using AppCmd). &lt;/LI&gt;
&lt;LI&gt;Searching - Allows you to quickly perform scoped searches of the configuration system for all the sections and where they are being used, becoming a great way to get a bigger picture of the server as well as to prevent configuration locking violations and many other uses. &lt;/LI&gt;
&lt;LI&gt;Locking - Allows you to do advanced locking such as locking specific attributes so that they cannot be used in deeper locations, lock individual items in a collection or lock the entire section, etc. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Please give us feedback on things you would like to see or change at the IIS Forums: &lt;A title=http://forums.iis.net/1149.aspx href="http://forums.iis.net/1149.aspx" mce_href="http://forums.iis.net/1149.aspx"&gt;http://forums.iis.net/1149.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;OK, but rather than keep with more and more text, I will just show you a video on how it looks and all its features (for those of you who like text, there is a transcript below).&lt;/P&gt;&lt;IFRAME style="WIDTH: 800px; HEIGHT: 600px" src="http://silverlight.services.live.com/invoke/56183/ConfigurationEditor/iframe.html" frameBorder=0 scrolling=no mce_src="http://silverlight.services.live.com/invoke/56183/ConfigurationEditor/iframe.html"&gt;&lt;/IFRAME&gt;
&lt;H2&gt;Transcript:&lt;/H2&gt;
&lt;P&gt;So I have here Windows Vista SP 1 with the IIS Admin Pack installed, in my machine I have very few applications installed but should be good to show some of the features on config editor. When entering Config Editor, first thing you will notice is that at the top you have a drop-down list that shows all the sections currently schematized and ready to be used in your system. &lt;/P&gt;
&lt;P&gt;Since this is sorted alphabetically, the first section that gets selected is AppSettings, for I can very easily switch between ASP.NET configuration sections, such as system.web/authentication, or the IIS configuration sections such as system.webServer/defaultDocument or the system.applicationHost/sites that contains all the sites configuration for IIS.&lt;/P&gt;
&lt;P&gt;As you can see the user interface displays the configuration elements and properties of the section that is selected, providing you an easy way to see every single configuration property available in the system. &lt;/P&gt;
&lt;P&gt;At the top you'll get a label specifying the deepest path where this section is being used relevant to your scope, so in this case its telling us that its been set in ApplicationHost.config. After that, all the elements and properties are shown in a Property Grid, that displaye elements as a collapsible set of properties. One of the interesting things is that we provide validation for the properties for example, when entering string characters in a numeric property type an error message will be displayed giving you the details of the expected types. Additionaly other benefits such as type editors, so that when editing a property of type boolean, you get the True/False drop-down, or when a property that is of type enumeration such as the LogFormat inside the SiteDefaults, you will get a drop-down list with only the list of options that are allowed for that enumeration. Same way, when editing a property of type flags such as the logExtFileFlags that contains the fields to include in the log file, you will get a multi-select drop-down list where you can select and de-select the different options. Also, you will notice that additional information is displayed as you select the different properties, giving you details of their data type as well as additional validations for those that have some, for example, the truncateSize property has specified that only a certain range is considered valid, if I type a value that is not within that range it will show this message giving me details of the problem.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Making Changes&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now, lets move to a simpler section so that we can show other features of the Configuration Editor. For example here in default documents, if I want to disable it I just change it to False and click Apply. As you would expect all the changes are applied and to see what changes this actually made in my system I'm going to show a Diff of the configuration that I have backed up and indeed the only change that happened in my configuration system is that it changed from true to false.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Collection Editor&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;As you will notice there is a collection in this section, all the collections are shown in an advanced collection editor that will let you see all the information of the items on it, including the ability to add, remove and clear the collection, as well as lock individual items on it. It additionally shows where each of the individual items is coming from making it easier to understand the distributed configuration. &lt;/P&gt;
&lt;P&gt;Another thing you will notice is that this collection editor shows some visual cues to help you deal with data, for example this little key here tells you that this property is the unique key of the collection item. &lt;/P&gt;
&lt;P&gt;So lets actually add a new one, for that I just need to click Add and fill the values, in this case, lets add Home.aspx as a new default document. After doing that, I can close dialog and click Apply. And lets take a look at what happened to my configuration. As you can see the new item was added. So as you can see its really easy to see and change configuration in collections.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script Generation&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now, one of the interesting things that it also has is those changes that I just did, its great but sometimes I dont want to apply them immediately but instead automate them so that I can apply them at a later time. For example, lets just change the attribute Enabled back to true, and rather than just applying the change as we did before, I want to generate the script cause probably I'm creating a provisioning script for my site and I want to include this as part of it, so just by clicking Generate Script I get this dialog that gives you the code for Managed Code using Microsoft.Web.Administration in C#, and as you can see its quite easy to read. It also gives you JavaScript code that uses a COM library that our configuration system ships called Microsoft.ApplicationHost, and just as the managed code version it just sets the value. It also gives you command line for it, so you dont need to build code or scripts, you can just run the command line and to prove that, lets actually just run this command line. First lets show the diff again so that we see that its set to false. Now lets run the command line AppCmd which lives in Inetsrv directory. Now lets show the difference again, and as you can see it actually sets the value as expected. As you can see this will help you write scripts or code to manipulate IIS and ASP.NET settings without requiring additional knowledge. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Locking&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Another interesting feature is locking, for example if I want to make sure that my default documents are always enabled and no one else can override them, I can go here and select the enabled attribute and click lock attribute which will prevent it from being changed in any other web.config file. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Search Configuration&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now, another interesting feature which is probably one of the most powerful features is the ability to search configuration so that you can see a high-level overview of the configuration system and all the web.config files on it. Just click Search Configuration. This shows me this dialog that shows me the root web.config that includes all the section that are being set on it, it also shows me applicationHost.config that includes again all the sections being used on it, as well as a location tag for a particular application that includes also some sections for it. you will notice that I also have a couple of applications that include web.config's in their folders, and sub-folders. where we can see how for example in this web.config it includes some &lt;/P&gt;
&lt;P&gt;one of the neat features is that you can actually click any of this nodes and it will immediately display the content of the section as well as where its coming from. For example if I click the web.config my entire web.config is displayed, if I click a specific section it only displays the content of the section. I can even click the locationPath that I'm interested and only get that particular one. &lt;/P&gt;
&lt;P&gt;Additionally you can easily search who is changing the authorization settings from asp.net and as easy as that you can see all the places in your server where the authorization settings are being set and quickly identify all the settings that are being used in your server. This feature is extremely useful because now, you can easily search for example default Document and make sure nobody is changing it and make sure no one else is violating the locking we just did. &lt;/P&gt;
&lt;P&gt;It also allows you to see the files in a flat view where it gives you all the different paths and files where each of them is coming from. You get the exact functionality, its just a different visual representation of the config.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Schema-Driven&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Another interesting thing is that if you want to build your own sections and extend our configuration system, you can go to the schema folder and write your own configuration section, declare it using our schema notation, here I'm just defining a section named mySection, that includes an attribute called enabled of type bool and an attribute called message of type string and an attribute password of type string that should be encrypted.. Now, I just need to edit applicationHost.config to define the section so that config system knows we are going to consume it . Just by doing that, now I can go back to config editor and refresh the window, and my section is now available in the drop down, and as you would expect it displays all of the properties I defined, and I can just go ahead and set them, and I get all the locking functionality, I get all the script generation, I get all the UI validation.&lt;/P&gt;
&lt;P&gt;And if I apply, you will see that as expected the changes are done, the password attribute is encrypted, etc.&lt;/P&gt;
&lt;P&gt;So as you can see configuration editor is an extremely powerful feature that will be really useful for successfully managing the web.config's in your system.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8343863" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS+Manager/default.aspx">IIS Manager</category></item><item><title>IIS 7.0 Admin Pack: Request Filtering</title><link>http://blogs.msdn.com/carlosag/archive/2008/03/24/IISAdminPackRequestFiltering.aspx</link><pubDate>Mon, 24 Mar 2008 17:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8333900</guid><dc:creator>CarlosAg</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8333900.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8333900</wfw:commentRss><description>&lt;P&gt;My last post talked about the Technical Preview release of the IIS 7.0 Admin Pack, and how it includes 7 new features that will help you manage your IIS 7.0.&lt;/P&gt;
&lt;P&gt;Today I was going to start writing about more details about each feature and &lt;A href="http://blogs.iis.net/bills/" target=_blank mce_href="http://blogs.iis.net/bills/"&gt;Bill Staples&lt;/A&gt; just &lt;A href="http://blogs.iis.net/bills/archive/2008/03/23/how-to-un-block-directories-with-iis7-web-config.aspx" target=_blank mce_href="http://blogs.iis.net/bills/archive/2008/03/23/how-to-un-block-directories-with-iis7-web-config.aspx"&gt;posted&lt;/A&gt; something (How to (un)block directories with IIS7 web.config) that almost seems that it was planned for me to introduce one of the features in the Admin Pack, namely &lt;STRONG&gt;Request Filtering UI.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;IIS 7.0 includes a feature called &lt;A href="http://learn.iis.net/page.aspx/143/how-to-use-request-filtering/" target=_blank mce_href="http://learn.iis.net/page.aspx/143/how-to-use-request-filtering/"&gt;Request Filtering&lt;/A&gt; that provides additional capabilities to secure your web server, for example it will let you filter requests that are double escaped, or filter requests that are using certain HTTP Verbs, or even block requests to specific "folders", etc. I will not go into the details on this functionality, if you want to learn more about it you can see the &lt;A href="http://learn.iis.net/page.aspx/143/how-to-use-request-filtering/" target=_blank mce_href="http://learn.iis.net/page.aspx/143/how-to-use-request-filtering/"&gt;Request Filtering articles&lt;/A&gt; over &lt;A href="http://learn.iis.net/" mce_href="http://learn.iis.net"&gt;http://learn.iis.net&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In his blog Bill mentions how you can easily configure Request Filtering using any text editor, such as notepad, and edit the web.config manually. That was required since we did not ship UI within IIS Manager for it due to time constraints and other things. But now as part of the Admin Pack we are releasing UI for managing the Request Filtering settings. &lt;/P&gt;
&lt;P&gt;Following what Bill just showed in his blog, this is the way you would do it using the new UI instead.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1) Install &lt;/STRONG&gt;&lt;A href="http://blogs.msdn.com/carlosag/archive/2008/03/21/IISAdminPackTP1Released.aspx" target=_blank mce_href="http://blogs.msdn.com/carlosag/archive/2008/03/21/IISAdminPackTP1Released.aspx"&gt;&lt;STRONG&gt;IIS Admin Pack (Technical Preview)&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2) Launch IIS Manager&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3) Drill down using the Tree View to the site or application you want to change the settings for.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4)&amp;nbsp; Enter into the new feature called Request Filtering inside the IIS category&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.carlosag.net/images/RequestFiltering1.gif" mce_src="http://www.carlosag.net/images/RequestFiltering1.gif"&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;5) Select the Hidden Segments and choose "Add Hidden Segment" from the Task List on the right&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.carlosag.net/images/RequestFiltering2.gif" mce_src="http://www.carlosag.net/images/RequestFiltering2.gif"&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;6) Add the item&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;As you would expect the outcome is exactly as Bill explained in his blog, just an entry within you web.config, something like:&lt;/P&gt;
&lt;DIV class=code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;security&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;requestFiltering&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;hiddenSegments&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;add&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; segment&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="log"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;hiddenSegments&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;requestFiltering&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;security&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;So as you can see the Request Filtering UI will help you discover some of the nice security settings that IIS 7.0 has. The following images show some of the additional settings you can configure, such as Verbs, Headers, URL Sequences, URL Length, Quey String size, etc.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.carlosag.net/images/requestfiltering3.gif" mce_src="http://www.carlosag.net/images/requestfiltering3.gif"&gt; &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.carlosag.net/images/requestfiltering4.gif" mce_src="http://www.carlosag.net/images/requestfiltering4.gif"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8333900" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS+Manager/default.aspx">IIS Manager</category></item><item><title>Search your configuration sections in web.config files using IIS 7.0 API's</title><link>http://blogs.msdn.com/carlosag/archive/2008/03/19/SearchConfigurationSectionsInWebConfigFilesUsingIIS.aspx</link><pubDate>Wed, 19 Mar 2008 03:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8324255</guid><dc:creator>CarlosAg</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/8324255.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=8324255</wfw:commentRss><description>&lt;H2&gt;Background&lt;/H2&gt;
&lt;P&gt;In IIS 7.0 we have the great functionality to allow you to configure the Web Server settings in a distributed way, including the IIS configuration along with the ASP.NET configuration in the web.config files by using Configuration Sections. For example, the following shows a web.config adding a default document (home.aspx) to a Web Application inside my Default Web Site:&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;configuration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;defaultDocument&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;add&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; value&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="home.aspx"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;defaultDocument&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.web&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;authentication&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; mode&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Forms"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;system.web&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;configuration&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;Now, that is great but it does come with a price, specially for server administrators it means that now you need to deal with a distributed configuration environment where certain settings are applied at the server level and certain settings are applied along with the application or even folders.&lt;/P&gt;
&lt;P&gt;Another interesting challenge is that given the nature of distributed configuration, we've added the functionality to lock certain configuration sections so that they can only be set by a server administrator. Again this is good, however before the server administrator locks any section in order to prevent breaking applications they should search configuration and see if anyone is using that configuration section underneath.&lt;/P&gt;
&lt;H2&gt;Searching Configuration&lt;/H2&gt;
&lt;P&gt;The IIS 7.0 configuration system has a not so well-known feature that allows you to "query" the configuration system to get an overview of the configuration files in the system as well as the configuration sections that are used in each of them. This feature is implemented as a magical section called &lt;STRONG&gt;configPaths&lt;/STRONG&gt;, that has the following schema:&lt;/P&gt;
&lt;DIV class=code&gt;&amp;nbsp; &lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;sectionSchema&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="configPaths"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;collection&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; addElement&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="searchResult"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;attribute&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="path"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; type&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="string"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;attribute&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="locationPath"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; type&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="string"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;attribute&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="status"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; type&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="uint"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;collection&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; addElement&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="section"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#800000&gt;attribute&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="name"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; type&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="string"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; isUniqueKey&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="true"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;/&amp;gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;collection&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;collection&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#800000&gt;sectionSchema&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt; &lt;/DIV&gt;
&lt;H2&gt;How to use it&lt;/H2&gt;
&lt;P&gt;One thing that is pretty cool is that you can consume this section from all of our tools, including a command line (AppCmd.exe), a script (such as vbscript or javascript using Microsoft.ApplicationHost.AdminManager), or using Managed Code (Microsoft.Web.Administration) including the ability to use it under PowerShell. For this exercise we will only use Microsoft.Web.Administration,&amp;nbsp; but the concepts are exactly the same in the other tools.&lt;/P&gt;
&lt;P&gt;In its simplest form you can use the following function to display all the configuration files in your server as well as the sections included on them (just add a reference to Windows\System32\Inetsrv\Microsoft.Web.Administration.dll):&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;/// &amp;lt;summary&amp;gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;/// Displays the list of configuration files as well as the&amp;nbsp; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;///&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sections being used in each file &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#006400&gt;/// &amp;lt;/summary&amp;gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;private&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;static&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;DisplaySections()&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ServerManager&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;serverManager&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ServerManager&lt;/FONT&gt;&lt;FONT color=#000000&gt;())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Configuration&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;appHost&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;serverManager.GetApplicationHostConfiguration()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ConfigurationSection&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPaths&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;appHost.GetSection(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"configPaths"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;foreach&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ConfigurationElement&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;in&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPaths.GetCollection())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;path&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#000000&gt;)configPath[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"path"&lt;/FONT&gt;&lt;FONT color=#000000&gt;]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;locationPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#000000&gt;)configPath[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"locationPath"&lt;/FONT&gt;&lt;FONT color=#000000&gt;]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Config Path:" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;path)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;if&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(!&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;String&lt;/FONT&gt;&lt;FONT color=#000000&gt;.IsNullOrEmpty(locationPath))&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"&amp;nbsp; &amp;lt;locationPath path=" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;locationPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt; "'&amp;gt;"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;foreach&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ConfigurationElement&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;section&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;in&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPath.GetCollection())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; " &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;section[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"name"&lt;/FONT&gt;&lt;FONT color=#000000&gt;])&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt; &lt;/DIV&gt;An example result of running this is: 
&lt;DIV class=code&gt;&lt;PRE&gt;&lt;STRONG&gt;Config Path:MACHINE/WEBROOT/APPHOST
&lt;/STRONG&gt;    system.applicationHost/applicationPools
    system.webServer/defaultDocument
    system.webServer/ImageCopyright
    system.applicationHost/sites
    system.webServer/security/authentication/windowsAuthentication
    system.webServer/tracing/traceProviderDefinitions
    ...

&lt;STRONG&gt;Config Path:MACHINE/WEBROOT/APPHOST
  &amp;lt;locationPath="Default Web Site/BlogApp"&amp;gt;
&lt;/STRONG&gt;    system.webServer/security/authentication/windowsAuthentication

&lt;STRONG&gt;Config Path:MACHINE/WEBROOT/APPHOST
  &amp;lt;locationPath path="Default Web Site/aspnet_client"&amp;gt;
&lt;/STRONG&gt;    system.webServer/directoryBrowse
    system.webServer/handlers

&lt;STRONG&gt;Config Path:MACHINE/WEBROOT/APPHOST
  &amp;lt;locationPath path="Site2/aspnet_client"&amp;gt;
&lt;/STRONG&gt;    system.webServer/directoryBrowser
    system.webServer/handlers
    system.webServer/defaultDocument

&lt;STRONG&gt;Config Path:MACHINE/WEBROOT/APPHOST
  &amp;lt;locationPath path="Default Web Site"&amp;gt;
&lt;/STRONG&gt;    system.webServer/security/authentication/anonymousAuthentication
    system.webServer/directoryBrowse
    system.webServer/security/authentication/windowsAuthentication

&lt;STRONG&gt;Config Path:MACHINE/WEBROOT/APPHOST/Default Web Site
&lt;/STRONG&gt;    appSettings
...&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;This tells us that in ApplicationHost.config we have a lot of sections begin used including applicationPools and many more. &lt;/P&gt;
&lt;P&gt;Now, lets focus on the last two set of entries, the one with "MACHINE/WEBROOT/APPHOST" with locationPath set to "Default Web Site" tells us that anonymousAuthentication was used as well as windowAuthentication. The locationPath basically tells the configuration that even though this is set in ApplicationHost.config this configuration should only be applied to Default Web Site and its children. The next entry with path "MACHINE/WEBROOT/APPHOST/Default Web Site", basiclally tells you that in the &lt;STRONG&gt;Web.config &lt;/STRONG&gt;inside the Default Web Site (in other words in c:\inetpub\wwwroot\web.config) the section appSettings is being used. &lt;/P&gt;
&lt;P&gt;Now, what is interesting is that this is walking the entire server to find configuration files and do a lot of processing, however if you already know that you only want to search within a Site, or a particular application, then you can scope it down by using the GetWebConfiguration() method instead and this will give you only the configuration sections that apply for that site or application. Note that this will also report the sections that are specifically set for that object inside ApplicationHost.config making it much more than just a "findstr" inside the site folder and their virtual directories.&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;DisplaySectionsForSite(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Default Web Site"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;private&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;static&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;DisplaySectionsForSite(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;siteName)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ServerManager&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;serverManager&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ServerManager&lt;/FONT&gt;&lt;FONT color=#000000&gt;())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Configuration&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;appHost&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;serverManager.GetWebConfiguration(siteName)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ConfigurationSection&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPaths&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;appHost.GetSection(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"configPaths"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;foreach&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ConfigurationElement&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;in&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPaths.GetCollection())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;path&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#000000&gt;)configPath[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"path"&lt;/FONT&gt;&lt;FONT color=#000000&gt;]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;locationPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT color=#000000&gt;)configPath[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"locationPath"&lt;/FONT&gt;&lt;FONT color=#000000&gt;]&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine()&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Config Path:" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;path)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;if&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(!&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;String&lt;/FONT&gt;&lt;FONT color=#000000&gt;.IsNullOrEmpty(locationPath))&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"&amp;nbsp; &amp;lt;locationPath path=" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;locationPath&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt; "'&amp;gt;"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;foreach&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;ConfigurationElement&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;section&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;in&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;configPath.GetCollection())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#2b91af&gt;Console&lt;/FONT&gt;&lt;FONT color=#000000&gt;.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; " &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;section[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"name"&lt;/FONT&gt;&lt;FONT color=#000000&gt;])&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;;&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt; &lt;/DIV&gt;
&lt;H2&gt;PowerShell&lt;/H2&gt;
&lt;P&gt;Now, lets look at other examples, lets consider that we are a server administrator and I want to lock the defaultDocument section, but as a good citizen I first want to see if I would be breaking any application in my entire server if I do this. Just for fun lets do this using PowerShell instead, to test this just copy the entire code below and paste in inside an &lt;STRONG&gt;elevated&lt;/STRONG&gt; PowerShell window.&lt;/P&gt;
&lt;DIV class=code&gt;&lt;FONT color=#2b91af&gt;$sectionToLookFor&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt; "*defaultdocument*" &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;[System.Reflection.Assembly]::LoadWithPartialName(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"Microsoft.Web.Administration"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$iis&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;new-object&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;Microsoft.Web.Administration.ServerManager&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$configPaths&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;=&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$iis&lt;/FONT&gt;&lt;FONT color=#000000&gt;.GetApplicationHostConfiguration().GetSection(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"configPaths"&lt;/FONT&gt;&lt;FONT color=#000000&gt;).GetCollection()&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;foreach&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$path&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;in&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$configPaths&lt;/FONT&gt;&lt;FONT color=#000000&gt;.GetCollection())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;foreach&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$section&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;in&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$path&lt;/FONT&gt;&lt;FONT color=#000000&gt;.GetCollection())&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;if&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$section&lt;/FONT&gt;&lt;FONT color=#000000&gt;.GetAttributeValue(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"name"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;-like&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$sectionToLookFor&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;{&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;write&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$path&lt;/FONT&gt;&lt;FONT color=#000000&gt;.GetAttributeValue(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"path"&lt;/FONT&gt;&lt;FONT color=#000000&gt;)&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt; " LocationPath:" &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$path&lt;/FONT&gt;&lt;FONT color=#000000&gt;.GetAttributeValue(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"locationPath"&lt;/FONT&gt;&lt;FONT color=#000000&gt;))&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;write&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; " &lt;/FONT&gt;&lt;FONT color=#000000&gt;+&lt;/FONT&gt;&lt;FONT color=#808080&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#2b91af&gt;$section&lt;/FONT&gt;&lt;FONT color=#000000&gt;.GetAttributeValue(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"name"&lt;/FONT&gt;&lt;FONT color=#000000&gt;))&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt;&lt;FONT color=#808080&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;}&lt;/FONT&gt; &lt;/DIV&gt;
&lt;P&gt;The result in my machine gives you something like follows:&lt;/P&gt;
&lt;DIV class=code&gt;MACHINE/WEBROOT/APPHOST &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; system.webServer/defaultDocument &lt;BR&gt;MACHINE/WEBROOT/APPHOST/Default Web Site/aspnet_client &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; system.webServer/defaultDocument &lt;BR&gt;MACHINE/WEBROOT/APPHOST/Site2/aspnet_client &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; system.webServer/defaultDocument &lt;/DIV&gt;
&lt;P&gt;This tells us that inside the c:\inetpub\wwwroot\aspnet_client\web.config file we are actually using that section so if we end up locking this in the server we would break that application.&lt;/P&gt;
&lt;H2&gt;Summary&lt;/H2&gt;
&lt;P&gt;The configPaths section is a very useful section that allows you to search configuration files and the configuration sections being used in each of them, making it an invaluable tool for scenarios like understanding the configuration usage as well as locking and many others.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8324255" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/Microsoft.Web.Administration/default.aspx">Microsoft.Web.Administration</category></item><item><title>Using Microsoft.Web.Administration in Windows PowerShell</title><link>http://blogs.msdn.com/carlosag/archive/2008/02/11/MicrosoftWebAdministrationInPowershell.aspx</link><pubDate>Mon, 11 Feb 2008 03:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7596437</guid><dc:creator>CarlosAg</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/7596437.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=7596437</wfw:commentRss><description>&lt;P&gt;A couple of months ago I wrote about using LINQ with Microsoft.Web.Administration to manage and query IIS 7.0 configuration. Somebody came back to me and said that LINQ was very cool but that it was very much Developer oriented and that in a production server without VS or .NET 3.5 it wouldn't be an option. Indeed that is a very valid comment and so I decided to show similar stuff with a tool that is available in Windows and its more IT oriented, Windows PowerShell. &lt;/P&gt;
&lt;P&gt;So in this blog I will quickly mention some of the things you can easily do with Microsoft.Web.Administration inside Windows PowerShell. &lt;/P&gt;
&lt;P&gt;To start working with Microsoft.Web.Administration the first thing you need to do is load the assembly so that you can start using it. It is quite easy using the methods from the Assembly type. &lt;/P&gt;
&lt;DIV class=code&gt;[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration") &lt;/DIV&gt;
&lt;P&gt;Once you have the assembly available then you will need to create an instance of our ServerManager class that gives you access to the entire configuration system. &lt;/P&gt;
&lt;DIV class=code&gt;$iis = new-object Microsoft.Web.Administration.ServerManager &lt;/DIV&gt;
&lt;P&gt;The above line basically declares a variable called &lt;SPAN style="FONT-FAMILY: Courier New"&gt;$iis &lt;/SPAN&gt;that we will be able to use for all of our configuration tasks. &lt;/P&gt;
&lt;P&gt;Now to more interesting stuff. &lt;/P&gt;
&lt;P&gt;Getting the list of Sites &lt;/P&gt;
&lt;P&gt;Getting the list of sites is as easy as just accessing the Sites collection, this will output all the information about sites &lt;/P&gt;
&lt;DIV class=code&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis = new-object Microsoft.Web.Administration.ServerManager &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis.sites &lt;/STRONG&gt;&lt;BR&gt;ApplicationDefaults : Microsoft.Web.Administration.ApplicationDefaults &lt;BR&gt;Applications : {DefaultAppPool, DefaultAppPool, DefaultAppPool, DefaultAppPool...} &lt;BR&gt;Bindings : {} &lt;BR&gt;Id : 1 &lt;BR&gt;Limits : Microsoft.Web.Administration.SiteLimits &lt;BR&gt;LogFile : Microsoft.Web.Administration.SiteLogFile &lt;BR&gt;Name : Default Web Site &lt;BR&gt;ServerAutoStart : True &lt;BR&gt;State : Started &lt;BR&gt;&lt;BR&gt;&lt;/DIV&gt;
&lt;P&gt;However, we can also specify the information we care and the format we want to use, for example: &lt;/P&gt;
&lt;DIV class=code&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis = new-object Microsoft.Web.Administration.ServerManager &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis.sites | select-object Id, Name, State &lt;/STRONG&gt;&lt;BR&gt;Id Name State &lt;BR&gt;-- ---- ----- &lt;BR&gt;1 Default Web Site Started &lt;BR&gt;2 Site2 Started &lt;BR&gt;3 Site3 Started &lt;/DIV&gt;
&lt;P&gt;You can also use the where-object command to filter objects to get only the sites that are Stopped, and then we want to Start them. &lt;/P&gt;
&lt;DIV class=code&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis = new-object Microsoft.Web.Administration.ServerManager &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis.sites | where-object {$_.State -eq "Stopped"} | foreach-object { $_.Start() }&lt;/STRONG&gt; &lt;/DIV&gt;
&lt;P&gt;OK, now let's imagine I want to find all the applications that are configured to run in the Default ApplicationPool and move them to run in my NewAppPool. This is better to do it in three lines: &lt;/P&gt;
&lt;DIV class=code&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis = new-object Microsoft.Web.Administration.ServerManager &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis.sites | foreach { &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;$_.Applications | where { $_.ApplicationPoolName -eq 'DefaultAppPool' } | &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;foreach { $_.ApplicationPoolName = 'NewAppPool' } &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;} &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis.CommitChanges() &lt;/STRONG&gt;&lt;/DIV&gt;&lt;BR&gt;
&lt;P&gt;Now let's say I want to find the top 20 distinct URL's of all the requests running in all my worker processes that has taken more than 1 second. &lt;/P&gt;
&lt;DIV class=code&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis = new-object Microsoft.Web.Administration.ServerManager &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis.WorkerProcesses | foreach { &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;$_.GetRequests(1000) | sort TimeElapsed -descending | &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;select-object Url -unique -first 20 } &lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;OK, finally let's say I want to display a table of all the applications running under DefaultAppPool and display if Anonymous authentication is enabled or not. (Now this one is almost on the edge of "you should do it differently, but it is Ok if you are only reading a single value from the section): &lt;/P&gt;
&lt;DIV class=code&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis = new-object Microsoft.Web.Administration.ServerManager &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;PS C:\ &amp;gt; $iis.Sites | foreach { &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;$_.Applications | where { $_.ApplicationPoolName -eq 'DefaultAppPool' } | &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;select-object Path,@{Name="AnonymousEnabled"; Expression = { &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;$_.GetWebConfiguration().GetSection("system.webServer/security/authentication/anonymousAuthentication").GetAttributeValue("enabled") &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;}} &lt;/STRONG&gt;&lt;BR&gt;&lt;STRONG&gt;} &lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;Again, the interesting thing is that now you can access all the functionality from M.W.A. from Windows PowerShell very easily without the need of compiling code or anything else. It does take some time to get used to the syntax, but once you do it you can do very fancy stuff. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7596437" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/Microsoft.Web.Administration/default.aspx">Microsoft.Web.Administration</category></item><item><title>Backgammon and Connect4 for Windows Mobile</title><link>http://blogs.msdn.com/carlosag/archive/2008/01/06/backgammon-and-connect4-for-windows-mobile.aspx</link><pubDate>Sun, 06 Jan 2008 21:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7008772</guid><dc:creator>CarlosAg</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/7008772.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=7008772</wfw:commentRss><description>&lt;P&gt;During the holidays my wife and I went back to visit our families in Mexico City where we are originally from. Again, during the flights I had enough spare time to build a couple of my favorite games, Backgammon and Connect4. &lt;/P&gt;
&lt;P&gt;I've already built &lt;A href="http://www.carlosag.net/Games/" mce_href="http://www.carlosag.net/Games/"&gt;both games for Windows using Visual Basic 5&lt;/A&gt; almost 11 years ago but as you would imagine I was far from feeling proud of the implementation. So this time I started from scratch and ended up with what I think are better versions of them (still not the best code, but pretty decent for just a few hours of coding). In fact the AI for the Backgammon version is a bit better and the Connect4 is faster and more suited for a Mobile device. &lt;/P&gt;
&lt;P&gt;You can go with your PDA/Smartphone to &lt;A href="http://www.carlosag.net/mobile/" mce_href="http://www.carlosag.net/mobile/"&gt;http://www.carlosag.net/mobile/&lt;/A&gt; to install both games or just click the images below to take you to the install page of each of them. Enjoy and feel free to add any feedback/features as comments to this blog post. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.carlosag.net/mobile/backgammon.aspx" mce_href="http://www.carlosag.net/mobile/backgammon.aspx"&gt;&lt;IMG alt="" src="http://www.carlosag.net/mobile/backgammonimage.jpg" border=0 mce_src="http://www.carlosag.net/mobile/backgammonimage.jpg"&gt;&lt;/A&gt; &lt;A href="http://www.carlosag.net/mobile/connect4.aspx" mce_href="http://www.carlosag.net/mobile/connect4.aspx"&gt;&lt;IMG alt="" src="http://www.carlosag.net/mobile/connect4image.jpg" border=0 mce_src="http://www.carlosag.net/mobile/connect4image.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;The one thing I learned during the development of these versions is that you do want to download the Windows Mobile 6 SDK if you are going to target that version (which is what my cell phone has), since it will add new Visual Studio 2005 Project Templates and new Emulator images which will help you a lot. For example I was trying to use buttons in my forms, and testing it in Pocket PC worked, but as soon as I tried them in my cell phone it crashed with a NotSupportedException. When I installed the SDK and switched to target that platform, Visual Studio immediately warned me that my platform didn't supported buttons which was great. &lt;/P&gt;
&lt;P&gt;Bottom line I'm more and more amazed of how easy it is to build games in Windows Mobile and the things you can achieve with both Windows Mobile and the .NET Compact Framework.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7008772" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Sudoku and Tetris Game for Windows Mobile</title><link>http://blogs.msdn.com/carlosag/archive/2007/12/21/SudokuAndTetrisForWindowsMobile.aspx</link><pubDate>Fri, 21 Dec 2007 21:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6829270</guid><dc:creator>CarlosAg</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/6829270.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=6829270</wfw:commentRss><description>&lt;P&gt;During my last two business trips (to Barcelona for TechEd and Mexico for ReMix) I was way too bored on the plane and since I recently got my Motorola Q9 (which is a sweet Windows Mobile Phone) decided to write myself a Tetris game and to port my Sudoku game to Windows Mobile as a way to do my "first steps" in the .NET Compact Framework. &lt;/P&gt;
&lt;P&gt;To my surprise it was really easy to write them and even more to port the desktop version of Sudoku to run in all the .NET Compact Framework platforms. &lt;/P&gt;
&lt;P&gt;Since holidays are coming I thought of share them as a gift for this holiday's season. &lt;/P&gt;
&lt;P&gt;Bottom line (with the risk of sounding like a marketing dude, which I'm not) .NET is a cool technology that makes it really easy to code for many devices, from high-end servers to hand held devices to mobile phones. In this case, I have tested these applications with a Pocket PC, Smartphone 2003, Windows Mobile 5 and Windows Mobile 6. And best of all, the code base is pretty much the same as the Desktop version. &lt;/P&gt;
&lt;P&gt;You can install both games by browsing from your mobile device to &lt;A href="http://www.carlosag.net/mobile/" mce_href="http://www.carlosag.net/mobile/"&gt;http://www.carlosag.net/mobile/&lt;/A&gt;&amp;nbsp;where you will find instructions on how to install the .cab files, or just click the images below to go to the download page for each game.&lt;/P&gt;
&lt;P&gt;&lt;A class="" title="Go to Sudoku Page" href="http://www.carlosag.net/mobile/sudoku.aspx" mce_href="http://www.carlosag.net/mobile/sudoku.aspx"&gt;&lt;IMG title="Sudoku for Windows Mobile" style="WIDTH: 161px; HEIGHT: 278px" height=278 alt="Sudoku for Windows Mobile" src="http://www.carlosag.net/mobile/sudoku.gif" width=161 mce_src="http://www.carlosag.net/mobile/sudoku.gif"&gt;&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A class="" title="Go to Tetris page" href="http://www.carlosag.net/mobile/tetris.aspx" mce_href="http://www.carlosag.net/mobile/tetris.aspx"&gt;&lt;IMG title="Tetris for Windows Mobile" style="WIDTH: 166px; HEIGHT: 265px" height=265 alt="Tetris for Windows Mobile" src="http://www.carlosag.net/mobile/Tetris.jpg" width=166 mce_src="http://www.carlosag.net/mobile/Tetris.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Happy holidays!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6829270" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Using LINQ with Microsoft.Web.Administration</title><link>http://blogs.msdn.com/carlosag/archive/2007/10/25/LINQAndMWA.aspx</link><pubDate>Thu, 25 Oct 2007 02:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5658529</guid><dc:creator>CarlosAg</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/5658529.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=5658529</wfw:commentRss><description>&lt;P&gt;With the upcoming release of .NET 3.5 and LINQ I thought it would be interesting to show some of the cool things you can do with IIS 7 and LINQ. Everything that I will do can be done with C# 2.0 code but it would take me several lines of code to write them but thanks to LINQ you can do them in about a line or two. &lt;/P&gt;
&lt;P&gt;Let's start with a very basic example that does not use LINQ but just M.W.A (Microsoft.Web.Administration) and then start adding interesting things to it. &lt;/P&gt;
&lt;P&gt;The following code just iterates the sites in IIS and displays their name. &lt;/P&gt;
&lt;DIV class=code&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System; &lt;BR&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Linq; &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; Microsoft.Web.Administration; &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Program&lt;/SPAN&gt; { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Main(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] args) { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt; serverManager = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt;()) { &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&lt;/SPAN&gt; sites = serverManager.Sites; &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;Site&lt;/SPAN&gt; site &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; sites) { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console&lt;/SPAN&gt;.WriteLine(site.Name); &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;BR&gt;&lt;/DIV&gt;Now, let's say I wanted to have them sorted by their name. This is where LINQ starts being useful &lt;BR&gt;
&lt;DIV class=code&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt; serverManager = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt;()) { &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&lt;/SPAN&gt; sites = (&lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; site &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; serverManager.Sites &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;orderby&lt;/SPAN&gt; site.Name &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select&lt;/SPAN&gt; site); &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;Site&lt;/SPAN&gt; site &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; sites) { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console&lt;/SPAN&gt;.WriteLine(site.Name); &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;/DIV&gt;Say you want to start all the sites that are stopped: &lt;BR&gt;
&lt;DIV class=code&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt; serverManager = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt;()) { &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&lt;/SPAN&gt; sites = (&lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; site &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; serverManager.Sites &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&lt;/SPAN&gt; site.State == &lt;SPAN style="COLOR: #2b91af"&gt;ObjectState&lt;/SPAN&gt;.Stopped &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;orderby&lt;/SPAN&gt; site.Name &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select&lt;/SPAN&gt; site); &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;Site&lt;/SPAN&gt; site &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; sites) { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;site.Start(); &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;/DIV&gt;OK, now let's imagine I want to find all the applications that are configured to run in the Default ApplicationPool and move them to run in my NewAppPool. This would take me a lot more lines of code but now I can just do: &lt;BR&gt;
&lt;DIV class=code&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt; serverManager = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt;()) { &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&lt;/SPAN&gt; apps = (&lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; site &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; serverManager.Sites &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;from&lt;/SPAN&gt; app &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; site.Applications &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&lt;/SPAN&gt; app.ApplicationPoolName.Equals(&lt;SPAN style="COLOR: #a31515"&gt;"DefaultAppPool"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;StringComparison&lt;/SPAN&gt;.OrdinalIgnoreCase) &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select&lt;/SPAN&gt; app); &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;Application&lt;/SPAN&gt; app &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; apps) { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;app.ApplicationPoolName = &lt;SPAN style="COLOR: #a31515"&gt;"NewAppPool"&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;serverManager.CommitChanges(); &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;/DIV&gt;Now let's say I want to find the top 20 distinct URL's of all the requests running in all my worker processes that has taken more than 1 second. &lt;BR&gt;
&lt;DIV class=code&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt; serverManager = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt;()) { &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&lt;/SPAN&gt; requests = ( &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;from&lt;/SPAN&gt; wp &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; serverManager.WorkerProcesses &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;from&lt;/SPAN&gt; request &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; wp.GetRequests(1000) &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;orderby&lt;/SPAN&gt; request.TimeElapsed &lt;SPAN style="COLOR: blue"&gt;descending &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select&lt;/SPAN&gt; request).Distinct().Take(20); &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;Request&lt;/SPAN&gt; request &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; requests) { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console&lt;/SPAN&gt;.WriteLine(request.Url); &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;}&lt;/SPAN&gt; &lt;BR&gt;&lt;/DIV&gt;OK, finally let's say I want to display a table of all the applications running under DefaultAppPool and display if Anonymous authentication is enabled or not. (Now this one is almost on the edge of "you should do it differently, but it is Ok if you are only reading a single value from the section): &lt;BR&gt;
&lt;DIV class=code&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt; serverManager = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServerManager&lt;/SPAN&gt;()) { &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&lt;/SPAN&gt; items = &lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; site &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; serverManager.Sites &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;from&lt;/SPAN&gt; app &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; site.Applications &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&lt;/SPAN&gt; app.ApplicationPoolName.Equals(&lt;SPAN style="COLOR: #a31515"&gt;"DefaultAppPool"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;StringComparison&lt;/SPAN&gt;.OrdinalIgnoreCase) &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;orderby&lt;/SPAN&gt; site.Name, app.Path &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Site = site, &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Application = app, &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AnoymousEnabled = ((&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt;)app.GetWebConfiguration().GetSection(&lt;SPAN style="COLOR: #a31515"&gt;"system.webServer/security/authentication/anonymousAuthentication"&lt;/SPAN&gt;)[&lt;SPAN style="COLOR: #a31515"&gt;"enabled"&lt;/SPAN&gt;]) &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}; &lt;/SPAN&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;var&lt;/SPAN&gt; item &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; items) { &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Site:{0,-18} App:{1, -10} Anonymous Enabled:{2}"&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;item.Site.Name, item.Application.Path, item.AnoymousEnabled); &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/SPAN&gt;&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt; &lt;BR&gt;&lt;/DIV&gt;As you can see LINQ is an incredibly useful feature in C# 3.0 and in conjunction with Microsoft.Web.Administration allows you to do incredibly complex operations in IIS with just few lines of code. &lt;BR&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5658529" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/Microsoft.Web.Administration/default.aspx">Microsoft.Web.Administration</category></item><item><title>The new Configuration System in IIS 7</title><link>http://blogs.msdn.com/carlosag/archive/2006/04/25/IIS7ConfigurationSystem.aspx</link><pubDate>Tue, 25 Apr 2006 23:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:583533</guid><dc:creator>CarlosAg</dc:creator><slash:comments>16</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/583533.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=583533</wfw:commentRss><description>Today I was planning on talking about the configuration classes that I purposedly skipped in my last post, but I realized it would be better to explain a little bit more about the new configuration system used in IIS 7.&lt;BR&gt;&lt;BR&gt;First of all, many of you (as me) will be extremely happy to know that the old "monolithic-centralized-admin only" metabase is dead, we have got rid of it for a much better configuration store. Now, before you feel panic, let me assure you that we haven’t just killed it and forget about the thousands of lines of scripts or custom tools built using the old metabase API’s (such as ABO), for that we have created something we called ABOMapper which will allow all of those applications to keep running transparently, since it will auto-magically translate the old calls to the metabase to actually modify the new configuration system.&lt;BR&gt;&lt;BR&gt;So what is this new configuration system? Well for those of you who have been working with ASP.NET for the past years, you will feel right at home and happy to know that we are moving to used the exact same concept as ASP.NET does &lt;B&gt;.config&lt;/B&gt; files.&lt;BR&gt;&lt;BR&gt;
&lt;H3&gt;ApplicationHost.config&lt;/H3&gt;At the root level we have a file called ApplicationHost.config that lives in the same directory of IIS (typically &amp;lt;windows&amp;gt;\System32\InetSrv\ directory). This is the main configuration file for IIS, this is where we store things like the list of sites, applications, virtual directories, general settings, logging, caching, etc.&lt;BR&gt;&lt;BR&gt;This file has two main groups of settings:&lt;ul&gt;&lt;li&gt;system.applicationHost: Contains all the settings for the activation service, basically things like the list of application pools, the logging settings, the listeners and the sites. These settings are centralized and can only be defined within applicationHost.config.&lt;/li&gt;&lt;li&gt;system.webServer: Contains all the settings for the Web server, such as the list of modules and isapi filters, asp, cgi and others. These settings can be set in applicationHost.config as well as any web.config (provided the Override Mode settings are set to allow)&lt;/li&gt;&lt;/ul&gt;&lt;IMG alt=ApplicationHost.config src="http://www.carlosag.net/images/appHost.png"&gt; &lt;BR&gt;&lt;B&gt;&lt;/B&gt;&lt;BR&gt;
&lt;H3&gt;Administration.config&lt;/H3&gt;This is also a file located in the IIS directory where we store delegation settings for the UI, including the list of modules (think of it as a UI Add-in) available, and other things like administrators.&lt;BR&gt;&lt;IMG alt=Administration.config src="http://www.carlosag.net/images/adminConfig.png"&gt; &lt;BR&gt;
&lt;H3&gt;Web.config&lt;/H3&gt;Finally the same old web.config from asp.net has gotten smarter and now you will be able to include server settings along with your asp.net settings.&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
&lt;H3&gt;Why is this important?&lt;/H3&gt;Well, as I said at the beginning the old metabase could only be accessed by administrators, so in order for someone to change a settings as simple as the default document for a specific application (say you want to change it to be index.aspx), you would need to be an administrator or call the administrator to do the changes. &lt;BR&gt;With this new distributed configuration system I can now safely modify the web.config within my application and have it my own way without disturbing anyone else. Furthermore, since it lives in my own web.config along with the content of my application I can safely XCopy the whole application and now even the web server settings are ready. No longer the case of going to InetMgr and start setting everything manually or creating a bunch of scripts to do that. &lt;BR&gt;
&lt;H3&gt;So how does this actually looks like:&lt;/H3&gt;&lt;BR&gt;In applicationHost.config my Sites section looks as follows: 
&lt;DIV class=code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;sites&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;site&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;name&lt;/FONT&gt;&lt;FONT color=blue&gt;="Default&amp;nbsp;Web&amp;nbsp;Site"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;id&lt;/FONT&gt;&lt;FONT color=blue&gt;="1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;application&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;path&lt;/FONT&gt;&lt;FONT color=blue&gt;="/"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;applicationPool&lt;/FONT&gt;&lt;FONT color=blue&gt;="DefaultAppPool"&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;virtualDirectory&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;path&lt;/FONT&gt;&lt;FONT color=blue&gt;="/"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;physicalPath&lt;/FONT&gt;&lt;FONT color=blue&gt;="c:\inetpub\wwwroot"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;application&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;bindings&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;binding&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;protocol&lt;/FONT&gt;&lt;FONT color=blue&gt;="HTTP"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;bindingInformation&lt;/FONT&gt;&lt;FONT color=blue&gt;="*:80:"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;bindings&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;site&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;sites&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;/FONT&gt; &lt;/DIV&gt;This basically defines a site that has a root application with a virtual directory that points to \inetpub\wwwroot. This site is listening on any IP address on port 80. &lt;BR&gt;Say I wanted to add a new application and make it listen also in port 8080. 
&lt;DIV class=code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;sites&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;site&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;name&lt;/FONT&gt;&lt;FONT color=blue&gt;="Default&amp;nbsp;Web&amp;nbsp;Site"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;id&lt;/FONT&gt;&lt;FONT color=blue&gt;="1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;application&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;path&lt;/FONT&gt;&lt;FONT color=blue&gt;="/"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;applicationPool&lt;/FONT&gt;&lt;FONT color=blue&gt;="DefaultAppPool"&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;virtualDirectory&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;path&lt;/FONT&gt;&lt;FONT color=blue&gt;="/"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;physicalPath&lt;/FONT&gt;&lt;FONT color=blue&gt;="c:\inetpub\wwwroot"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;application&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;SPAN style="BACKGROUND-COLOR: #ffffcc"&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;application&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;path&lt;/FONT&gt;&lt;FONT color=blue&gt;="/MyApp"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;applicationPool&lt;/FONT&gt;&lt;FONT color=blue&gt;="DefaultAppPool"&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=black&gt;&lt;BR&gt;&lt;SPAN style="BACKGROUND-COLOR: #ffffcc"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="BACKGROUND-COLOR: #ffffcc"&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;virtualDirectory&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;path&lt;/FONT&gt;&lt;FONT color=blue&gt;="/"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;physicalPath&lt;/FONT&gt;&lt;FONT color=blue&gt;="d:\MyApp"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="BACKGROUND-COLOR: #ffffcc"&gt;&lt;FONT color=blue&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;application&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;bindings&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;binding&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;protocol&lt;/FONT&gt;&lt;FONT color=blue&gt;="HTTP"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;bindingInformation&lt;/FONT&gt;&lt;FONT color=blue&gt;="*:80:"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="BACKGROUND-COLOR: #ffffcc"&gt;&amp;lt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="BACKGROUND-COLOR: #ffffcc"&gt;&lt;FONT color=maroon&gt;binding&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;protocol&lt;/FONT&gt;&lt;FONT color=blue&gt;="HTTP"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;bindingInformation&lt;/FONT&gt;&lt;FONT color=blue&gt;="*:8080:"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=blue&gt;&lt;SPAN style="BACKGROUND-COLOR: #ffffcc"&gt;/&amp;gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;bindings&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;site&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;sites&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;/FONT&gt; &lt;/DIV&gt;Just by adding the previous markup, I can now browse to http://localhost:8080/MyApp &lt;BR&gt;&lt;B&gt;IIS Settings in web.config&lt;/B&gt; &lt;BR&gt;More interesting I can now add a file called web.config to c:\MyApp\web.config, and set the content to be: 
&lt;DIV class=code&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;configuration&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;defaultDocument&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;files&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;clear&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/FONT&gt;&lt;FONT color=maroon&gt;add&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;value&lt;/FONT&gt;&lt;FONT color=blue&gt;="Index.aspx"&lt;/FONT&gt;&lt;FONT color=red&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;files&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;defaultDocument&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;system.webServer&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=maroon&gt;configuration&lt;/FONT&gt;&lt;FONT color=blue&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;/FONT&gt; &lt;/DIV&gt;And with this change, my application now will respond using index.aspx whenever /MyApp is requested. &lt;BR&gt;You can extrapolate from this that all the IIS settings for your application including authentication, authorization, asp and cgi settings, the list of modules, custom errors, etc can be configured within your web.config and never have to request changes to administrators again. &lt;BR&gt;&lt;BR&gt;Of course this brings the question, isn’t this insecure? The answer is no, by default all the IIS sections (except DefaultDocuments) is locked at the applicationHost.config, meaning no one can change them within their web.config unless explicitly changed by the administrator. The cool thing is that the administrator can change it and customize it per application allowing certain apps to change settings while preventing others from doing it. All this can be done through plain config using Notepad or using the &lt;B&gt;very cool NEW InetMgr&lt;/B&gt; (which I will blog about it later) &lt;BR&gt;Finally, the following image shows the hierarchy of config files for each url. &lt;IMG alt="config hierarchy" src="http://www.carlosag.net/images/hierarchy.png"&gt; &lt;BR&gt;&lt;BR&gt;Now that I have shown a high level overview of how configuration works in IIS 7, I will finally blog about the API to actually change this settings programmatically using Managed code and Microsoft.Web.Administration.dll&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=583533" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Microsoft.Web.Administration in IIS 7</title><link>http://blogs.msdn.com/carlosag/archive/2006/04/17/MicrosoftWebAdministration.aspx</link><pubDate>Mon, 17 Apr 2006 08:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:577355</guid><dc:creator>CarlosAg</dc:creator><slash:comments>44</slash:comments><comments>http://blogs.msdn.com/carlosag/comments/577355.aspx</comments><wfw:commentRss>http://blogs.msdn.com/carlosag/commentrss.aspx?PostID=577355</wfw:commentRss><description>While creating the new administration stack in &lt;B&gt;IIS 7&lt;/B&gt;, we were looking into the different ways users could manipulate the server configuration as well as the new runtime information available in IIS 7 (Internally we call this RSCA-Runtime State and Control API) from managed code, and we realized we needed to provide a simpler and more straight forward API that developers could consume from managed code. Microsoft.Web.Administration is the answer to this problem. This API is designed to be simple to code against in an “intellisense-driven” sort of way. At the root level a class called ServerManager exposes all the functionality you will need. &lt;BR&gt;&lt;BR&gt;To show the power and simplicity of this API, let’s look at some samples below. To try this samples just create a new Console Application in Visual Studio and add a reference to Microsoft.Web.Administration.dll that can be found at IIS directory (%WinDir%\System32\InetSrv).&lt;BR&gt;Please note that the following code is based on Windows Vista Beta 2 code and will likely change for the release candidate versions of Windows Vista since we have planned several enhancements to simplify the API and expose more features into it.&lt;BR&gt;The following picture shows the main objects (excluding Configuration related classes).&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&lt;IMG alt=Microsoft.Web.Administration src="http://www.carlosag.net/images/ServerManager.png" mce_src="http://www.carlosag.net/images/ServerManager.png"&gt;&lt;BR&gt;&lt;B&gt;Creating a Site&lt;/B&gt;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;
&lt;DIV class=code&gt;&lt;FONT color=black&gt;ServerManager&amp;nbsp;iisManager&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;new&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ServerManager()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.Sites.Add(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"NewSite"&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"http"&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"*:8080:"&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"d:\\MySite"&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.Update()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;/FONT&gt; &lt;/DIV&gt;This basically creates an instance of the ServerManager class and uses the Add method in the Sites collection to create a new site named "NewSite" listening at port 8080 using http protocol and content files are at d:\MySite.&lt;BR&gt;One thing to note is that calling Update is a requirement since that is the moment when we persist the changes to the configuration store.&lt;BR&gt;After running this code you have now a site that you can browse using http://localhost:8080&lt;BR&gt;&lt;BR&gt;&lt;B&gt;Adding an Application to a site&lt;/B&gt; 
&lt;DIV class=code&gt;&lt;FONT color=black&gt;ServerManager&amp;nbsp;iisManager&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;new&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ServerManager()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.Sites[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"NewSite"&lt;/FONT&gt;&lt;FONT color=black&gt;].Applications.Add(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"/Sales"&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"d:\\MyApp"&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.Update()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;/FONT&gt; &lt;BR&gt;&lt;BR&gt;&lt;BR&gt;This sample uses the Sites collection Indexer to get NewSite site and uses the Applications collection to add a new http://localhost:8080/Sales application. &lt;BR&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;B&gt;Creating a Virtual Directory&lt;/B&gt; 
&lt;DIV class=code&gt;&lt;FONT color=black&gt;ServerManager&amp;nbsp;iisManager&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;new&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ServerManager()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;Application&amp;nbsp;app&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.Sites[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"NewSite"&lt;/FONT&gt;&lt;FONT color=black&gt;].Applications[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"/Sales"&lt;/FONT&gt;&lt;FONT color=black&gt;]&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;app.VirtualDirectories.Add(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"/VDir"&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#808080&gt;"d:\\MyVDir"&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.Update()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;/FONT&gt; &lt;/DIV&gt;&lt;BR&gt;&lt;BR&gt;&lt;B&gt;Runtime State and Control&lt;/B&gt;&lt;BR&gt;&lt;BR&gt;Now, moving on to the new Runtime state and control information we also expose in this objects information about their current state as well as the ability to modify them. For example, we expose the list of W3WP processes running (Worker processes) and what I think is really cool, &lt;B&gt;we even expose the list of requests currently running&lt;/B&gt;. &lt;B&gt;Stopping a Web Site&lt;/B&gt; 
&lt;DIV class=code&gt;&lt;FONT color=black&gt;ServerManager&amp;nbsp;iisManager&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;new&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ServerManager()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.Sites[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"NewSite"&lt;/FONT&gt;&lt;FONT color=black&gt;].Stop()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;/FONT&gt; &lt;/DIV&gt;&lt;BR&gt;&lt;B&gt;Recyciling an Application Pool&lt;/B&gt; 
&lt;DIV class=code&gt;&lt;FONT color=black&gt;ServerManager&amp;nbsp;iisManager&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;new&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ServerManager()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.ApplicationPools[&lt;/FONT&gt;&lt;FONT color=#808080&gt;"DefaultAppPool"&lt;/FONT&gt;&lt;FONT color=black&gt;].Recycle()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;/FONT&gt; &lt;/DIV&gt;&lt;BR&gt;&lt;B&gt;Getting the list of executing requests&lt;/B&gt; 
&lt;DIV class=code&gt;&lt;FONT color=black&gt;ServerManager&amp;nbsp;iisManager&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;new&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ServerManager()&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;foreach&lt;/FONT&gt;&lt;FONT color=black&gt;(WorkerProcess&amp;nbsp;w3wp&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;in&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;iisManager.WorkerProcesses)&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"W3WP&amp;nbsp;({0})"&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;w3wp.ProcessId)&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;(Request&amp;nbsp;request&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;in&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;w3wp.GetRequests(&lt;/FONT&gt;&lt;FONT color=maroon&gt;0&lt;/FONT&gt;&lt;FONT color=black&gt;))&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(&lt;/FONT&gt;&lt;FONT color=#808080&gt;"{0}&amp;nbsp;-&amp;nbsp;{1},{2},{3}"&lt;/FONT&gt;&lt;FONT color=black&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;request.Url,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;request.ClientIPAddr,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;request.TimeElapsed,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;request.TimeInState)&lt;/FONT&gt;&lt;FONT color=blue&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;}&lt;BR&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;/DIV&gt;Another big thing on this API is the ability to edit the “.config” files using a simple API, this includes the ability of modifying the main applicationHost.config file from IIS, web.config files from asp.net as well as machine.config and other config files (such as administration.config). However I will talk about them in a future post. &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=577355" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/carlosag/archive/tags/IIS/default.aspx">IIS</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/carlosag/archive/tags/Microsoft.Web.Administration/default.aspx">Microsoft.Web.Administration</category></item></channel></rss>