无法读取配置节'system.web.extensions',因为它缺少节声明

问题描述 投票:46回答:6

我在使用.NET Framework 4.0在Server 2008 32位计算机上安装我的Web应用程序时收到错误(配置部分system.web.extensions无法读取,因为它缺少部分声明)。但它在2008年r2 64位机器上运行良好。

这是我的网络配置文件信息

<configuration>
<runtime>
    <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647"/>
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>

有什么想法摆脱这个错误?

注意:我已经检查了Stack over flow中的所有相关条目,但没有什么对我有用

asp.net .net iis-7 web-config iis-7.5
6个回答
67
投票

尝试将应用程序池运行时从.net 2.0更改为.net 4.0


42
投票

在我的Web配置文件中添加以下配置设置后,问题已解决

<configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

我们可以参考这篇文章了解更多信息:http://www.morgantechspace.com/2013/11/The-configuration-section-system-web-extensions-cannot-be-read-because-it-is-missing-a-section-declaration.html


8
投票

将操作系统从Windows Server 2003升级到Windows Server 2008 R2后,我也遇到了同样的问题,我只是将应用程序池设置更改为.NetFramework 4.0.0,并将经典更改为集成模式...我的问题解决了..


2
投票

可能相关的问题:.NET using wrong 2.0 machine.config instead of 4.0。我遇到过类似的问题...并为我解决方案:

不确定,这是原因/解决方案,但最后我尝试的是(在IIS管理器中):

  1. 导航到右侧面板中的服务器(根节点)
  2. 在功能列表中打开“ISAPI和CGI限制”
  3. 有2个项目描述ASP.NET v4.0.30319,限制设置为Deny
  4. 将限制值设置为“允许”

这是我在问题消失之前尝试过的最后一件事。


1
投票

记下您安装的.netFramework版本v4 ...(示例v4.0.030319)编辑您的应用程序池以更正.NET Framework v4 ..

祝好运

-Satish


0
投票
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

我尝试了这个,它对我有用。也许对某人有帮助。


0
投票

对我来说,将应用程序池.NET Framework版本从v2.0更改为v4.0解决了此问题。

打开IIS - >选择应用程序池 - >从列表中选择应用程序池 - >从上下文菜单中选择基本设置... - >将.NET Frame版本更改为v4.0

© www.soinside.com 2019 - 2024. All rights reserved.