Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Error 500.19 in IIS 8 when system.web configuration is present in apphost config

Tags:

asp.net

iis

iis-8

We have a utility that automatically sets up ASP.NET web applications upon install on customer servers. This utility traditionally adds a number of configurations to the Location path for the new app in applicationHost.config. We do this programmatically using the Microsoft.Web.Administration configuration classes.

This works fine in IIS 7.0 and IIS 7.5, but when we try to install the identical configuration in IIS 8 (Server 2012), we start getting 500.19 server errors for everything hosted on the server because of a supposedly malformed XML element (HRESULT 0x8007000d). I systematically went through all of the configuration we install, and it appears to be the the system.web/httpRuntime maxRequestLength attribute (see below). It appears that the system.web configuration element itself is the culprit, as the error does not disappear until it itself is removed.

I've confirmed that the section definition for system.web/httpRuntime states that it is allowed Everywhere, and you can set system.web configuration at other levels of the configuration (e.g., web.config) without issue. Why can't we set it in applicationHost.config?

<location path="Default Web Site/ManagementConsole">
    <!-- ... more config ... -->
    <system.web>
        <httpRuntime maxRequestLength="10240" />
    </system.web>
</location>

Edit: I noticed after the original post that the file the 500.19 error referenced was a temporary app pool config file (C:\inetpub\temp\apppools\apppoolname\apppoolname.config. The content of that file is:

<!-- ERROR: There's been an error reading or processing the applicationhost.config file.  Line number: 905  Error message: The configuration section 'system.web' cannot be read because it is missing a section declaration
-->

But when I go into applicationHost.config and add a section group definition for system.web and a section definition for httpRuntime, the message in the 500.19 changes to claiming that there is a duplicate system.web/httpRuntime definition! So I can't define it, and I can't not define it. What??

like image 753
Jamie Macia Avatar asked Jan 29 '13 18:01

Jamie Macia


3 Answers

I've seen this error occur when all of the necessary modules are not installed. Instead of telling you that a module is missing it will complain that the config is corrupt. Check that the same modules you've installed on the IIS 7/7.5 machines are also installed on IIS 8.

like image 98
GrokSrc Avatar answered Nov 18 '22 16:11

GrokSrc


In our case we didn't have URL Rewrite installed. Instead of complaining about it missing it just gave us this generic message.

I think what you need to do when transferring a site from IIS 7.x to 8.x is first verify all of the addons are properly installed.

like image 44
NotMe Avatar answered Nov 18 '22 16:11

NotMe


I had a similar issue which I posted to SO here. Also take a look at this post on Feature Delegation.

like image 2
Mr Smith Avatar answered Nov 18 '22 18:11

Mr Smith