C
cody
I keep getting a null reference when trying to access my config file
through my windows service, I have placed the xml config file in my
debug folder with my .exe, and my code is shown below.
//where I call the app.config file
f =
X10Unified.Senders.Firecracker.GetInstance(Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["COM_Port"]));
//the config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGroup, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="namespace.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<namespace.Properties.Settings>
<setting name="namespace_Service_gLink"
serializeAs="String">
<value>url</value>
</setting>
<setting name="COM_Port" serializeAs="String">
<value>"3"</value>
</setting>
</namespace.Properties.Settings>
</applicationSettings>
</configuration>
through my windows service, I have placed the xml config file in my
debug folder with my .exe, and my code is shown below.
//where I call the app.config file
f =
X10Unified.Senders.Firecracker.GetInstance(Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["COM_Port"]));
//the config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings"
type="System.Configuration.ApplicationSettingsGroup, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="namespace.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<namespace.Properties.Settings>
<setting name="namespace_Service_gLink"
serializeAs="String">
<value>url</value>
</setting>
<setting name="COM_Port" serializeAs="String">
<value>"3"</value>
</setting>
</namespace.Properties.Settings>
</applicationSettings>
</configuration>