web.config的问题
初学.net,今天写程序的时候被web.config困扰了,是这样的:
<configuration>
<configSections>
<section name="ApplicationConfiguration" type="RoomRent.SystemFramework.ApplicationConfiguration, RoomRent.SystemFramework" />
<section name="RoomRentConfiguration" type="RoomRent.Common.RoomRentConfiguration, RoomRent.Common" />
</configSections>
<system.web>
<customErrors
defaultRedirect="errorpage.aspx"
mode="Off"
/>
<compilation
debug="true" />
<!-- The sessionState is currently set to inproc: the lines following [mode="inproc"] are not used but are present for ease of configuration -->
<sessionState
cookieless="false"
timeout="20"
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
/>
<globalization
responseEncoding="utf-8"
requestEncoding="utf-8" />
<!-- security -->
<authentication mode="Forms">
<forms name=".ADUAUTH" loginUrl="secure\logon.aspx" protection="All" >
</forms>
</authentication>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<!--
<ApplicationConfiguration>
<add key="SystemFramework.Tracing.Enabled" value="False"/>
<add key="SystemFramework.Tracing.TraceFile" value="RoomRentTrace.txt"/>
<add key="SystemFramework.Tracing.TraceLevel" value="4"/>
<add key="SystemFramework.Tracing.SwitchName" value="RoomRentTraceSwitch"/>
<add key="SystemFramework.Tracing.SwitchDescription" value="Error and information tracing for RoomRent"/>
<add key="SystemFramework.EventLog.Enabled" value="True"/>
<add key="SystemFramework.EventLog.Machine" value="."/>
<add key="SystemFramework.EventLog.SourceName" value="RoomRent"/>
<add key="SystemFramework.EventLog.LogLevel" value="1"/>
</ApplicationConfiguration>
-->
<RoomRentConfiguration>
<add key="RoomRent.DataAccess.ConnectionString" value="server=localhost; User ID=sa;Password=;database=HouseRentSystem;Connection Reset=FALSE" />
<!--
<add key="RoomRent.Web.EnablePageCache" value="True"/>
<add key="RoomRent.Web.PageCacheExpiresInSeconds" value="3600"/>
<add key="RoomRent.Web.EnableSsl" value="False"/>
-->
</RoomRentConfiguration>
</configuration>
但是我读取设置的时候
System.Configuration.ConfigurationSettings.GetConfig("ApplicationConfiguration");
System.Configuration.ConfigurationSettings.GetConfig("RoomRentConfiguration");
会报错:
配置错误
说明: 在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。
分析器错误信息: 创建节处理程序时发生异常。
源错误:
行 3: <configSections>
行 4: <section name="ApplicationConfiguration" type="RoomRent.SystemFramework.ApplicationConfiguration, RoomRent.SystemFramework" />
行 5: <section name="RoomRentConfiguration" type="RoomRent.Common.RoomRentConfiguration, RoomRent.Common" />
行 6: </configSections>
行 7:
源文件: d:\inetpub\wwwroot\roomrentv1\web\web.config 行: 5
请问这是为什么啊?