加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – IIS 7在一个服务器上引发web.config的“重复部分定义

发布时间:2020-12-16 00:27:15 所属栏目:asp.Net 来源:网络整理
导读:我有3台服务器,所有这些都运行Windows Web Server,.NET 4和IIS7。我的web.config文件的开头部分是: ?xml version="1.0"?configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" configSections section name="loggingConfiguration"
我有3台服务器,所有这些都运行Windows Web Server,.NET 4和IIS7。我的web.config文件的开头部分是:
<?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,PublicKeyToken=31bf3856ad364e35" />
    <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching,PublicKeyToken=31bf3856ad364e35" />
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup,System.Web.Extensions,Version=3.5.0.0,PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup,PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup,PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection,PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection,PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection,PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection,PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

这在2台服务器上工作正常,但其中一个报告错误:

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

反对:

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

如果我删除单行,那么它会抱怨下一行的副本,等等,直到我删除几乎所有的配置部分。

有什么想法会导致什么?

编辑:

这是一个更新为VS 2010和.NET 4的.NET 3.5应用程序。所有3台服务器都安装了.NET 2 / 3.5和4。 IIS应用程序池已经更新到.NET 4。

在所有3台服务器中,machine.config文件中已经定义了一些这样的web.config部分(就像Damien的回答提到的那样),但是在3个抱怨中只有一个被重复。

解决方法

在“破碎”服务器上,您的应用程序池正在运行.NET 4.0。修复是将应用程序池设置为运行为.NET 2.0。

因为ASP.NET AJAX是在.NET 2.0之后发明的,因此配置定义从未将它放入中央web.config中,因此您必须在大多数情况下以每个站点的形式声明它们。 4.0清理了大量的这个cruft,具有打破ASP.NET以前版本的默认配置的副作用。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读