For example,
I can specify the session timeout in the web.config file by adding:
<system.web>
<sessionState timeout="10"/>
</system.web>
Or I can configure the session timeout in IIS by going to the Application Configuration Options.
If they are both configured to different values, which one wins? And more specifically, do all other settings follow the same pattern?
EDIT: I don't see them being as one in the same. The web.config wins. And when I change the value in IIS, nothing gets written back to the web.config.
There's a definite disconnect between the settings in the web.config and the settings in IIS. I haven't read any good documentation on which one overrides the other. All I've observed is that the web.config wins. I thought someone else may have some more insight into this disparity.
Too late to answer but may clear things up for future people who get here.
This article explains inheritance between IIS
and ASP.net
applications.
Quote from Tip 3: Understand how your Web.config inherits IIS configuration settings
Of course, server administrators don't necessarily want to allow any application on the server to modify settings via Web.config, so there are configurable policies in the ApplicationHost.config which state whether individual applications can override settings.
This post explains the usage of two ApplicationHost.config
attributes: overrideModeDefault
and allowDefinition
. Both of these attributes set whether and who can override IIS
settings which are inside ApplicationHost.config
.
Based on those two, we cannot say undoubtedly that web.config
overrides IIS
, if we are not aware about ApplicationHost.config
entries.
Quote from: Introduction to ApplicationHost.config
Most IIS sections are locked down by default, using overrideModeDefault="Deny" in the section.
The one in web.config 'wins'.
Edit: Basically when you edit settings from UI the changes are written back to web.config
They are one in the same.
Settings configured in the IIS Manager are added to the root applicationHost.config file for your server (located in C:\Windows\System32\inetsrv\config) as <location path="your-site/subfolder">
elements. Since settings in a web.config always override those in the applicationHost.config, if the same setting has one value in the IIS Manager and another in your web.config, the web.config value 'wins'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With