当apphost配置中存在system.web配置时,IIS 8中出现HTTP错误500.19 [英] HTTP Error 500.19 in IIS 8 when system.web configuration is present in apphost config

查看:201
本文介绍了当apphost配置中存在system.web配置时,IIS 8中出现HTTP错误500.19的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个实用程序,可以在客户服务器上安装后自动设置ASP.NET Web应用程序.传统上,该实用程序在applicationHost.config中为新应用程序的位置"路径添加许多配置.我们使用Microsoft.Web.Administration配置类以编程方式进行此操作.

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.

这在IIS 7.0和IIS 7.5中可以正常工作,但是当我们尝试在IIS 8(Server 2012)中安装相同的配置时,由于假定的XML元素格式不正确,我们开始对服务器上托管的所有内容出现500.19服务器错误( HRESULT 0x8007000d).我系统地检查了我们安装的所有配置,它似乎是system.web/httpRuntime maxRequestLength属性(请参见下文).似乎system.web配置元素本身是罪魁祸首,因为直到将其自身删除,该错误才会消失.

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.

我已经确认system.web/httpRuntime的部分定义指出了Everywhere,并且您可以在其他配置级别(例如,web.config)设置sy​​stem.web配置,而不会出现问题.为什么我们不能在applicationHost.config中设置它?

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>

我在原始帖子之后注意到,引用500.19错误的文件是一个临时应用程序池配置文件(C:\ inetpub \ temp \ apppools \ apppoolname \ apppoolname.config.该文件的内容为:

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
-->

但是,当我进入applicationHost.config并为system.web添加一个节组定义和为httpRuntime添加一个节定义时,500.19中的消息更改为声称存在重复的system.web/httpRuntime定义!因此,我无法定义它,也无法定义它.什么??

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??

推荐答案

在我们的例子中,我们没有安装URL Rewrite.与其抱怨缺少它,它只是给了我们这个通用的信息.

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

我认为将站点从IIS 7.x迁移到8.x时需要做的是首先确认所有插件均已正确安装.

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.

这篇关于当apphost配置中存在system.web配置时,IIS 8中出现HTTP错误500.19的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆