C# 错误:键';SecurityKey';appSettings配置部分中不存在

C# 错误:键';SecurityKey';appSettings配置部分中不存在,c#,visual-studio-2013,C#,Visual Studio 2013,当我在开发我的应用程序(Winform)的计算机上执行它时,没有错误,但当我在另一台计算机上执行它时,我得到了错误。我的App.config如下所示: <?xml version="1.0"?> <configuration> <appSettings> <add key="SecurityKey"/> </appSettings> <startup> <supp

当我在开发我的应用程序(Winform)的计算机上执行它时,没有错误,但当我在另一台计算机上执行它时,我得到了错误。我的App.config如下所示:

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="SecurityKey"/>
    </appSettings>
    <startup>
        <supportedRuntime version="v4.0"sku="...."/>
    </startup>
</configuration>
我已经试过了,但还是一样


有什么建议吗?

配置文件中的appSettings与.settings文件不同

看一看

我还要提到,我不知道settingsReader和ConfigurationManager如何使用没有值的键:

<add key="SecurityKey"/> <!-- no value? -->
<add key="SecurityKeyWithValue" value="myvalue"/>



调用GetValue时出错?settingsReader是什么类型?这可能无法解决您的问题,但我更喜欢使用ConfigurationManager.Appsettings[“SecurityKey”]来阅读Appsettings。希望它能帮助您。我可以请您在答案周围添加更多上下文。只有代码的答案很难理解。如果你能在你的文章中添加更多的信息,这将有助于询问者和未来的读者。
<add key="SecurityKey"/> <!-- no value? -->
<add key="SecurityKeyWithValue" value="myvalue"/>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="SecurityKey" value="Syed Moshiur Murshed"/>
  </appSettings>
</configuration>