Bill Brown bio photo

Bill Brown

A complicated man.

Twitter Github

At work today, I ran into some trouble trying to set up a virtual directory as an application in IIS. My two applications, the parent and the child, occupied different locations in the filesystem, had separate app pools, and different app names. Due to the inheritance of Web.config, though, the HTTP modules defined in the parent app were throwing configuration exceptions in the child app even though the child app never referenced any of the HTTP modules.

I thought about adding an httpModule section to the child app's Web.config with a remove call, but that seemed klunky to me. Frantic Google searching wasn't giving any better solutions. Following the link chains from blog entry to blog entry to comments to more blog entries, I stumbled upon the answer:

<location inheritinchildapplications="false">
  <system.web>
   <httpmodules>
    …
   </httpmodules>
  </system.web>
</location>
source

Of course! This breaks the inheritance chain and it only touches the parent app's Web.config.