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

遇到的第一个问题:
iis7管理介面,在设置主机头时,报告如下错误:
文件名:xx\xx\xxx\web.config
行号:133
错误:无法读取配置节"system.web.extensions",因为它缺少节声明

上网查了,老外也遇到这样的问题:
Line number: 154 
Error: The configuration section 'system.web.extensions' cannot be read because it is missing a section declaratio
http://our.umbraco.org/forum/getting-started/installing-umbraco/10095-Umbraco-45-Dontnetpanel-Server-Error-systemwebextensions

由于是空间服务商更换了服务器,应用了IIS7。给了我远程桌面的操作权限,运行环境先检查下:
1.已经安装.net 4.0运行库
2.设置网站基于.net4.0(连接侧边栏>应用程序池>相应网站>右键,选基本设置>选择运行库)
3.修改“托管管道模式”,Set the Manage Pipeline mode from Integrated to Classic (由集成到经典
Run website on IIS7 (Vista) in classic mode
IIS托管管道模式的集成和经典比较
问题还是没有解决。

在微软的论坛找到了解决的办法:
http://forums.asp.net/p/1547286/3784899.aspx
 

This is because config section hasn't declared. in 4.0 webconfig you have to add it manually.

<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"/>
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>

</configSections>

--------
如上添加后,在iis7的管理介面不再报错!

但问题还没有解决,网站不能访问,404错误,找不到文件或文件夹!
经查,是如下错误:
http错误 404.2 -not found
由于web服务器上的"isapi和CGI限制"列表设置,无法提供您请求的页面。
模块:IsapiModule
通知:ExecuteReauestHandler
处理程序:PageHandlerFactory-ISAPI-4.0_32bit
错误代码:0x800704ec

解决方案:
在IIS的根节点里  有个“ISAPI和CGI限制”设置,在里面选择.net4,选择允许,默认是限制的。

另外,网站报告访问限制,在网站的“授权规则”中,设置“允许”“所有用户”

至此,网站可以正常访问了!

©️2020 CSDN 皮肤主题: 程序猿惹谁了 设计师:上身试试 返回首页