其他配置文件

时间:2018-04-23 13:20:20

标签: c#

我已经在我的解决方案中加载了默认的App.config文件,我可以从中访问存储的变量。

XML

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="foo" value="bar"/>
  </appSettings>
</configuration>

C#

Configuration configManager = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
KeyValueConfigurationCollection config = configManager.AppSettings.Settings;
string foo = config["foo"].Value;

现在我已经创建了另一个配置文件来存储我的解决方案的另一部分的变量,但我无法弄清楚如何使用ConfigurationManager以相同的方式加载它。

Configuration config2 = ConfigurationManager.OpenExeConfiguration("path/to/config.config");

1 个答案:

答案 0 :(得分:1)

也许您正在寻找这个:

 2018-04-23T13:21:20.430586+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=avian-hero.herokuapp.com request_id=53d7abca-826a-40e3-a0db-68d6bdc9f3a6 fwd="80.1.113.164" dyno= connect= service= status=503 bytes= protocol=https
2018-04-23T13:21:20.584930+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=avian-hero.herokuapp.com request_id=860212c4-203c-4e9e-87f9-2df263203ac9 fwd="80.1.113.164" dyno= connect= service= status=503 bytes= protocol=https
相关问题