相关疑难解决方法(0)

App.config中的配置未正确提取

我正在尝试提取我保存到app.config文件的URL,但它返回一个空字符串.有什么想法吗?

string asdf = String.Format("{0}", ConfigurationManager.AppSettings["MemberUrl"]);
Run Code Online (Sandbox Code Playgroud)

和配置文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="ForumUrl" value="http://www.dreamincode.net/forums/xml.php?showforum=" />
    <add key="MemberUrl" value="http://www.dreamincode.net/forums/xml.php?showuser=" />
  </appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)

c# app-config

4
推荐指数
1
解决办法
4071
查看次数

标签 统计

app-config ×1

c# ×1