IIS 7 and Above
Configuration & Scripting
System.Web in Applicationhost.config not working anymore (IIS8.5)
Last post Dec 04, 2014 05:30 AM by tempie007
Dec 03, 2014 06:49 AM|tempie007|LINK
We used to add the following section to our Applicationhost.config (IIS7).
Unfortunately this does not work in IIS8 anymore. This seems like a bug.
<httpRuntime enableVersionHeader="false" />
The error that is thrown is:
( Also the Windows Process Activation Service (WAS) service does not start anymore after the change!)
ERROR: There's been an error reading or processing the applicationhost.config file. Line number: 2169 Error message: The configuration section 'system.web' cannot be read because it is missing a section declaration
When i add the section declaration in applicationhost.config ( by the way: in IIS7 this isn't required! ), i get the error below:
The worker process for application pool 'FEDC' encountered an error 'There is a duplicate 'system.web/httpRuntime' section defined
' trying to read configuration data from file '\\?\C:\inetpub\temp\apppools\ASDF\ASDF.config', line number '15'. The data field contains the error code.
Is there a workaround for this?
By the way, in my case this has nothing to do with modules being installed (a lot of threads on the web refer to this. This is not the case here!)
Dec 03, 2014 10:31 PM|Pengzhen Song - MSFT|LINK
It seems that we can't configure it in applicationhost.config. As a workaround, you can try configuring it in machine root web.config file which locates C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config.(64bit machine)
Or only configuring for special site, we can set it in site root web.config files.
Dec 04, 2014 05:30 AM|tempie007|LINK
This does indeed solve the problem . Strange that it worked in IIS7 but stopped working in IIS8.
Command to add it to Webroot .NET 4 and .NET 2
c:\windows\system32\inetsrv\appcmd.exe set config -section:system.web/httpRuntime -enableVersionHeader:false /commit:webroot /clr:2
c:\windows\system32\inetsrv\appcmd.exe set config -section:system.web/httpRuntime -enableVersionHeader:false /commit:webroot /clr:4