Web.config Inheritance in IIS Virtual Directories

Web.config inheritance can be a real pain in some circumstances. Essentially, the problem(s) that can occur are when you are hosting an application in the root of a website, and decided to add an application to subdirectory. In IIS you create a new application folder underneath the existing website, throw up your app and discover that it doesn’t work under the same configuration. The problem is that all settings set above your subdirectory application are now being applied by default, as such you will get errors that your sub application is declaring things in the web.config that already exist.

You have a couple of options. The first easy method is to add a clear statement:


This will clear any settings from being inherited in a specific node. However in often cases you will have this issue in a ton of areas, and the clear statement is just unmanageable (also this clears everything above it, even from the global web.config).

The second option is to use:

<location inheritInChildApplications=”false”>

Quite easy to implement, you wrap your entire system.web node in this location node. Some like this:

<location inheritInChildApplications=”false”>





All the settings inside the location node (and incidentally the system.web node) will NOT be inherited to any sub application folders. My expectation out of the box is that there would be an easy method of configuring this in IIS. Like an advanced property setting that says do not inherit settings…. but no luck.

This is issue is quite predominant on Google. Here is where I found the details: http://west-wind.com/weblog/posts/133041.aspx