retrieving settings from a library loaded from a service

D

Dan Holmes

i really thought i knew how to do this but...it isn't working.

I have a windows service (x.exe) that uses y.dll. both of them have a config file. x.exe.config and y.dll.config. I
installed the service and then merged the two configs into x.exe.config. I have changed the values in the x.exe.config
but the app is still using the default values.

Both the exe and the dll are in the same directory as are the config files.

Is there something different about this when using a service?

dan
 
C

Cesar

Are you using System.Configuration.ConfigurationManager.AppSettings["xxx"]
to retrieve the data?
 
D

Dan Holmes

NO, i am using this: Properties.Settings.Default.DebugFilename

I made it work but i am not sure why. I originally had this section in the dlls config.

<section name="RouteMatch.TS.RSE.ComAdapter.Properties.Settings" type="System.Configuration.ClientSettingsSection,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

I changed it so the section name matched that of the service and it worked.

<section name="RouteMatch.TS.RSE.Properties.Settings" type="System.Configuration.ClientSettingsSection, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

i had both sections in the config, is that not supported?

This works.
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="RouteMatch.TS.RSE.Properties.Settings" type="System.Configuration.ClientSettingsSection,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<applicationSettings>
<RouteMatch.TS.RSE.Properties.Settings>
<setting name="Port" serializeAs="String">
<value>23000</value>
</setting>
</RouteMatch.TS.RSE.Properties.Settings>
</applicationSettings>
</configuration>

This doesn't
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="RouteMatch.TS.RSE.Properties.Settings" type="System.Configuration.ClientSettingsSection,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="RouteMatch.TS.RSE.ComAdapter.Properties.Settings" type="System.Configuration.ClientSettingsSection,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<RouteMatch.TS.RSE.Properties.Settings>
<setting name="Port" serializeAs="String">
<value>23000</value>
</setting>
</RouteMatch.TS.RSE.Properties.Settings>
<RouteMatch.TS.RSE.ComAdapter.Properties.Settings>
<setting name="DebugFilename" serializeAs="String">
<value>c:\sandbox\RM_RSEServer_Debug_{0}_{1}.txt</value>
</setting>
</RouteMatch.TS.RSE.ComAdapter.Properties.Settings>
</applicationSettings>
</configuration>
Are you using System.Configuration.ConfigurationManager.AppSettings["xxx"]
to retrieve the data?



Dan Holmes said:
i really thought i knew how to do this but...it isn't working.

I have a windows service (x.exe) that uses y.dll. both of them have a
config file. x.exe.config and y.dll.config. I installed the service and
then merged the two configs into x.exe.config. I have changed the values
in the x.exe.config but the app is still using the default values.

Both the exe and the dll are in the same directory as are the config
files.

Is there something different about this when using a service?

dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top