C# 无法从web配置读取自定义节
为什么我不能从我的web配置中读取此内容?当我使用App.config时,它工作得很好 FundGroups=null Web.config:C# 无法从web配置读取自定义节,c#,web-config,custom-sections,C#,Web Config,Custom Sections,为什么我不能从我的web配置中读取此内容?当我使用App.config时,它工作得很好 FundGroups=null Web.config: <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="FundGroups" type="System.Configuration.NameValueSectionHandler" /
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="FundGroups" type="System.Configuration.NameValueSectionHandler" />
</configSections>
<FundGroups>
<add key="Group1" value="Value1" />
<add key="Group2" value="Value2" />
<add key="Group3" value="Value3" />
<add key="Group4" value="Value4" />
<add key="Group5" value="Value5" />
<add key="Group6" value="Value6" />
<add key="Group7" value="Value7" />
</FundGroups>
</configuration>
. 但是ConfigurationSettings.GetConfig似乎过时了,对我来说不起作用使用ConfigurationSettings.GetConfig可能会重复那里的答案。GetConfig过时了。。。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="FundGroups" type="System.Configuration.NameValueSectionHandler" />
</configSections>
<FundGroups>
<add key="Group1" value="Value1" />
<add key="Group2" value="Value2" />
<add key="Group3" value="Value3" />
<add key="Group4" value="Value4" />
<add key="Group5" value="Value5" />
<add key="Group6" value="Value6" />
<add key="Group7" value="Value7" />
</FundGroups>
</configuration>