IIS
How configuration system merges sections
Feb 11th
One of the things which was not clear to me when IIS7 configuration system was written was how configuration system merges all the configuration data available and then decide what values are effective for the current request. One of confusions came from the fact that I assumed that IIS modules try to read the values for the current URL and then keep moving up till it finds the attribute explicitly defined in a configuration file. This is part true for the configuration system but never for the modules. All modules do is ask the configuration system for a merged view of a particular configuration section for a configuration path which usually corresponds to the URL of the requested page. If you are familiar with AhAdmin, this corresponds to the following call.
List of registry keys affecting IIS7 behavior
Dec 30th
Few months ago, I fired procmon and collected all the registry keys IIS7 processes read. I then gathered the information about these registry keys from different people in the team and also collected available information on the internet. I have been sitting on this information for quite a while hoping to make it complete and finally I got enough time during this holiday period to finish this. Below is what all I could gather. Keys affecting FTP/FTP7 and Asp.Net are not included in this article. There are few IIS7 keys omitted from this list either because I couldn’t think of why people would like to change it or because we don’t want to people to modify those. If you see any information missing or incorrect as per your knowledge, please send me a message.
Ins & Outs of hostable web core
Dec 20th
I started writing an application which uses hostable web core (HWC) functionality of IIS7 and before making it available for download I thought it will be useful to write about HWC in detail. Hostable web core enables processes other than w3wp.exe to load IIS core and do almost everything that a worker process can do. One of these “hostable” solutions is the new IIS7 UI tool. It needs to be able to change the configuration of IIS without affecting itself. So the tool needs to run independent of IIS and HWC gives it exactly that.
How to read/write administration.config
Jul 26th
IIS7 configuration system understands machine.config, web.config and applicationHost.config but does not handle administration.config natively. This means reading and writing administration.config is little difficult. If you use AhAdmin directly and call GetAdminSection for a section defined in administration.config, it will throw a configuration error for all configuration paths saying that it couldn’t find the section in the configuration file. Easiest way you can work with administration.config is by using Microsoft.Web.Administration (MWA). ServerManager::GetAdministrationConfiguration gives you a Configuration object which represents administration.config. Below is a sample program which uses MWA to print UI module providers registered in administration.config.
class Program
{
Working with RSCA using configuration APIs
Jul 25th
One of the new features in IIS7 in windows server 2008 enable people to extend existing IIS configuration sections. If you have a schema file in schema folder which defines section already defined in IIS_Schema.xml, IIS configuration system will merge the schema defined in these two files. This enables you to add owner, email, phone properties to sites and have then keep this data under sites section in applicationHost.config. In addition to this, there is a new concept of dynamic properties. These are the properties which doesn’t have static values in configuration files but whose values can be supplied dynamically by some COM components. Dynamic properties can support get/set operations as other configuration properties. Other than get and set, configuration system allows you to define methods in schema which can be called using configuration APIs. These methods can accept input and return output as well.
Things you can do by piping appcmd commands
Jun 17th
Here are some of the cool things you can do by piping appcmd commands together in IIS7.
Application Pools
1. Recycle all application pools (replace recycle with start/stop to start/stop all apppools)
appcmd list apppool /xml | appcmd recycle apppool /in
2. Stop application pools with word "cheap" in it
appcmd list apppool /name:"$=*cheap*" /xml | appcmd stop apppool /in
3. Set property enable32BitAppOnWin64 to true for all apppools (Filter apppools as in 2 if needed)
Steps to enable tracing using appcmd
May 17th
Here are the steps you need to enable tracing for a site using appcmd.
1. Enable tracing for site.
2. Enable tracing for all request paths and for all response codes.
3. Appcmd leaves verbosity to default value “warning”. Get the providers count to change verbosity in step 4.