Dec 2, 2011

What’s the order of applying IIS settings from ApplicationHost.config and web.config


If I have an IIS setting configured both in ApplicationHost.config and web.config, what value is going to be applied? Is it an ApplicationHost.config value because it is global to all websites or web.config value because it overrides it? And what happens when I haven’t configured it in web.config, should it take this setting from ApplicationHost.config?

The particular setting I have to check is:

The reason I’m asking is because I’m getting quite strange results when I try to configure those settings from the C# application. Even if I haven’t configured it for the website and I have manually set the value in the ApplicationHost.config I’m still getting a default value from web.config


Config files inherit their values as you move down in scope (server -> site -> application), but by default it’s only for specific sections. The IIS site has an article on the ApplicationHost.config file as well as configuration delegation.

As an example, there are two different requestFiltering sections within applicationHost.config: one for an FTP server and one for web sites. You can see how the section for web sites (system.webServer) allows the values to be overridden:

<section name="requestFiltering" overrideModeDefault="Allow" />

Whereas the section under system.ftpServer does not.

<section name="requestFiltering" overrideModeDefault="Deny" />

So, onto your question. You should be able to update the Web.config to modify the allowed content length for your site (and sub-sites), unless you have changed the overrideModeDefault value in your applicationHost.config.

Related posts:

  1. Changing setting in applicationHost.config to Allow has no effect on 500.19 error
  2. Is it possible to set these IIS7 settings in a web.config file?
  3. Does editing applicationhost.config file restarts IIS 7?
  4. Is there way to tell IIS7 Manager modify handlers in applicationHost.config?
  5. IIS 7.5 (Express) applicationhost.config: Can a virtualDirectory’s physicalPath be a relative path?

Leave a comment