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

时间:2013-11-19 05:25:44

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

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

有任何想法摆脱这个错误吗?

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

7 个答案:

答案 0 :(得分:65)

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

答案 1 :(得分:41)

在我的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

答案 2 :(得分:8)

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

答案 3 :(得分:2)

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

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

  1. 导航到右侧面板中的服务器(根节点)
  2. 在功能列表中打开“ISAPI和CGI限制”
  3. 有2项描述ASP.NET v4.0.30319,限制设置为拒绝
  4. 将限制值设置为“允许”
  5. 在问题消失之前,这是我尝试过的最后一件事。

答案 4 :(得分:1)

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

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

答案 5 :(得分:0)

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

祝你好运

-Satish

答案 6 :(得分:0)

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

我尝试了这个,对我来说很好。也许对某人有帮助。

相关问题