无法读取配置节"appSettings",因为它缺少节声明 [英] The configuration section 'appSettings' cannot be read because it is missing a section declaration

查看:141
本文介绍了无法读取配置节"appSettings",因为它缺少节声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在清除ASP.NET临时Internet文件,并且不小心删除了一些.NET Framework文件(我有3.0、3.5、4.0和4.5),所以没有打开Visual Studio 10或Visual Studio 2012.我修复了所有.Net框架的安装,并且能够再次打开VS.尽管每个Web应用程序都是可构建的,但是在尝试运行任何Web应用程序时,都会出现web.config appSettings中的错误,尽管在删除事件之前appSettings可以正常工作.

I Was clearing ASP.NET Temporary Internet files and I accidentally deleted some .NET Framework files (I have 3.0, 3.5, 4.0 and 4.5) then neither Visual Studio 10 or Visual Studio 2012 was opening. I repaired the installation of all the .Net framework and I was able to open VS again. though every web application is buildable, when trying to run any, an error in web.config appSettings, though appSettings was working normally before the deleting incident, appears.

我不知道出了什么问题以及如何解决.

I don't know what went wrong and how to fix this.

IIS错误:

HTTP错误500.19-内部服务器错误

HTTP Error 500.19 - Internal Server Error

无法访问请求的页面,因为相关该页面的配置数据无效.

The requested page cannot be accessed because the related configuration data for the page is invalid.

错误代码

0x80070032

0x80070032

配置错误

无法读取配置节"appSettings",因为它是缺少部分声明

The configuration section 'appSettings' cannot be read because it is missing a section declaration

配置文件:

 <?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="CID.DAL" type="CID.DAL.Bases.NetTiersServiceSection, CID.DAL" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
    <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="CIDPortal.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
      <section name="CIDWebsite.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </sectionGroup>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <appSettings>
    <add key="BLL.CRUWebReference" value=""/>
    <add key="BLL.CRULogoPath" value=""/>
    <add key="BLL.KBIXMLPath" value="D:\App\KBI\XML\{0}\"/>
    <add key="BLL.CRUWebReference_Staging" value=""/>
    <add key="BLL.KBIXMLPath_IMC" value="D:\App\KBI\XML\{0}\"/>
    <add key="BLL.KBIXMLPath_STP" value="D:\App\KBI\XML\{0}\"/>
    <add key="BLL.KBIWSLink" value=""/>
    <add key="BLL.KBIWSHMCLink" value=""/>
  </appSettings>
  <connectionStrings>
    <add name="CID.DAL.ConnectionString" connectionString="Password=;Persist Security Info=True;User ID=;Initial Catalog=;Data Source="/>
    <add name="CID_OldConnectionString" connectionString="Data Source=;Initial Catalog=;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <CID.DAL defaultProvider="SqlNetTiersProvider">
    <providers>
      <add name="SqlNetTiersProvider" type="CID.DAL.SqlClient.SqlNetTiersProvider, CID.DAL.SqlClient" connectionStringName="CID.DAL.ConnectionString" providerInvariantName="System.Data.SqlClient" entityFactoryType="CID.DTO.EntityFactory" useEntityFactory="true" enableEntityTracking="true" enableMethodAuthorization="false" useStoredProcedure="true" defaultCommandTimeout="30"/>
    </providers>
  </CID.DAL>
  <system.web>
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <authentication mode="Windows"/>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </controls>
    </pages>
    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>
  </system.web>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
  <system.codedom>
      <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
          <providerOption name="CompilerVersion" value="v3.5"/>
          <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>
  <system.webServer>
      <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ScriptModule"/>
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
  </system.webServer>
  <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>
</configuration>

推荐答案

我有几次这个问题,第一次是.NET从IIS中注销"的.

I've had this issue a few times, the first time was when .NET had became "de-registered" from IIS

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

解决此问题(如果不使用64位计算机,则替换为.NET路径)

Fixed that (or substitute your .NET path if not using a 64 bit machine)

引起此问题的另一件事是,即使安装了.NET,IIS应用程序池也被设置为.NET 2.0而不是.NET 4.只需在IIS管理器中打开应用程序池,然后将其切换回即可.

The other thing that caused it was when the IIS Application pool was set to .NET 2.0 instead of .NET 4 even though .NET was installed. Just opened the app pool in IIS Manager and switched it back and it worked.

这篇关于无法读取配置节"appSettings",因为它缺少节声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆