J
Jeff0803
Guest
For some reason, I don't use App.Config but open configuration file from specified location using OpenMappedExeConfiguration.
Program loads configuration file successfully but fails when get the value of AppSettings value.
Here is the code snippet.
string config = @"c:\MyAppTest\test.cfg";
Configuration configfile;
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
configFileMap.ExeConfigFilename = configfile;
configobj = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
//I checked the configobj.FilePath is correctly acquired!
string strlog4net = ConfigurationManager.AppSettings["log4net.config"];//Error occur here because
//ConfigurationManager.AppSettings["log4net.config"]
//is null!
Can anybody help me to resolve this problem?
Continue reading...
Program loads configuration file successfully but fails when get the value of AppSettings value.
Here is the code snippet.
string config = @"c:\MyAppTest\test.cfg";
Configuration configfile;
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();
configFileMap.ExeConfigFilename = configfile;
configobj = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);
//I checked the configobj.FilePath is correctly acquired!
string strlog4net = ConfigurationManager.AppSettings["log4net.config"];//Error occur here because
//ConfigurationManager.AppSettings["log4net.config"]
//is null!
Can anybody help me to resolve this problem?
Continue reading...