IIS 7抛出"重复定义和QUOT部分;错误一台服务器上的web.config,而不是另一个 [英] IIS 7 throws "duplicate section defined" error for web.config on one server, but not another

查看:332
本文介绍了IIS 7抛出"重复定义和QUOT部分;错误一台服务器上的web.config,而不是另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3台服务器,所有这些都运行Windows Web服务器,.NET 4,和IIS7。我的web.config文件的开头部分:

I have 3 servers, all of which are running Windows Web Server, .NET 4, and IIS7. The beginning section of my web.config file is:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

这适用于服务器的2罚款,但他们中的一个报告错误:

This works fine on 2 of the servers, but one of them reports the error:

有一个重复的'System.Web.Extensions程序/脚本/ scriptResourceHandler'定义栏目

There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined

逆势而行:

<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />

如果我删除一行,然后将它抱怨下一行的副本,依此类推,直到我几乎删除所有的配置部分。

If I remove that single line, then it complains about a duplicate of the next line, and so on until I remove almost all of the config sections.

任何想法什么会导致此?

Any idea what would cause this?

编辑:

这是被更新为VS 2010和.NET 4。所有3台服务器安装了.NET 2 / 3.5,并安装4 .NET 3.5的应用程序。在IIS应用程序池已全部更新到.NET 4。

This was a .NET 3.5 application that was updated to VS 2010 and .NET 4. All 3 servers have .NET 2/3.5 and 4 installed. The IIS app pools have all been updated to .NET 4.

在所有3个服务器中,的machine.config 文件已经有一些在它定义了这些的web.config部分(如达明的回答中提到),但只有的1 3抱怨它被复制。

In all 3 servers, the machine.config file already has some of these web.config sections defined in it (as Damien's answer mentions), but only 1 of the 3 complains about it being duplicated.

推荐答案

在破服务器的应用程序池正在运行.NET 4.0。解决方法是设置应用程序池作为.NET 2.0中运行。

On the "broken" server your app pool is running .NET 4.0. The fix is to set the app pool to run as .NET 2.0.

由于ASP.NET AJAX是.NET 2.0以后发明的,配置的定义从未进入中央web.config文件,所以你不得不宣布他们在每个站点的基础在大多数情况下。 4.0清理大量的克鲁夫特,用打破的默认配置为ASP.NET的preceding版本的副作用。

Because ASP.NET AJAX was invented after .NET 2.0, the configuration definitions never made it into the central web.config so you had to declare them on a per-site basis in most circumstances. 4.0 cleaned up lots of that cruft, with the side effect of breaking the default configurations for preceding versions of ASP.NET.

这篇关于IIS 7抛出&QUOT;重复定义和QUOT部分;错误一台服务器上的web.config,而不是另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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