[2.0] can't read the content in <appSettings> in the config file
I am trying to read content in the <appsettings> tag in the config file in my windowsservice application. for some reason, I can't get any thing.
FileWatcherService.exe.Config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="FileNameAndPath" value="C:\Code\SavvysoftValuations" />
</appSettings>
</configuration>
Code to read:
_FilePath = System.Configuration.ConfigurationSettings.AppSettings.Get("FileNameAndPath");
Re: [2.0] can't read the content in <appSettings> in the config file
Try this if your using 2.0.
Code:
_FilePath = System.Configuration.ConfigurationManager.AppSettings["FileNameAndPath"]