我需要使用App.config文件获取" http://example.com ".
但目前我正在使用:
string peopleXMLPath = ConfigurationManager.AppSettings["server"];
Run Code Online (Sandbox Code Playgroud)
我无法获得价值.
你能指出我做错了什么吗?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="device" type="System.Configuration.SingleTagSectionHandler" />
<section name="server" type="System.Configuration.SingleTagSectionHandler" />
</configSections>
<device id="1" description="petras room" location="" mall="" />
<server url="http://example.com" />
</configuration>
Run Code Online (Sandbox Code Playgroud) 我尝试从一个小节中获取所有属性,但该节有很多小节并且应用程序无法识别,我该怎么办?这是我的网络配置:
<configSections>
<section name="Seccion" type="ManejoConfiguracion.SeccionConfig,ManejoConfiguracion"/>
</configSections>
<Seccion>
<BD>
<add key="name" value="dbKey" />
<add key="user" value="userBD" />
<add key="pass" value="123BD" />
</BD>
<ReportingService>
<add key="name" value="Reporting" />
<add key="user" value="userReport" />
</ReportingService>
</Seccion>
</configuration>
Run Code Online (Sandbox Code Playgroud)