【问题标题】:The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration无法读取配置部分“system.web.extensions”,因为它缺少部分声明
【发布时间】:2013-12-02 13:14:59
【问题描述】:

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

这是我的 webconfig 文件信息

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

有什么办法摆脱这个错误吗?

注意:我已经检查了堆栈溢出中的所有相关条目,但对我没有任何用处

【问题讨论】:

    标签: asp.net .net iis-7 web-config iis-7.5


    【解决方案1】:

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

    打开 IIS --> 选择 App Pools --> Select App Pool 从列表中 --> 从上下文菜单中选择 基本设置... --> 将 .NET Frame 版本更改为 v4.0

    【讨论】:

      【解决方案2】:
      c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
      

      我试过了,它对我很有用。也许对某人有帮助。

      【讨论】:

        【解决方案3】:

        记下.netFramework version v4... (examplev4.0.030319) 你已经安装 编辑您的应用程序池以更正 .NET Framework v4..

        祝你好运

        -萨蒂什

        【讨论】:

        • 这不能回答问题。
        【解决方案4】:

        在我的 webconfig 文件中添加以下配置设置后问题为我解决了

        <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

        【讨论】:

        • 在我的情况下,我没有在 web.config 中使用 scriptResourceHandler 或 jsonSerialization 并且包含上述部分导致问题继续存在。
        【解决方案5】:

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

        【讨论】:

        • 我在 2017 年创建新应用程序池时的默认 .NET 版本是 2002 年的 .NET 2.0。我只能想象为什么。
        • 谢谢你。我最近将 .NET 框架从 4.8 降级到 4.7.2,当我从系统中删除 4.8 时,IIS 决定降级我所有的应用程序池。当我重新安装 4.7.2 时,它并没有将它们设置回正确的版本。所以你的评论让我走上了正确的道路。
        【解决方案6】:

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

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

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

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

        【讨论】:

          【解决方案7】:

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

          【讨论】:

            猜你喜欢
            • 2011-09-16
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多