0

The context :

I have an winform application which is launch by users on the local network (path: \\file-01\appsdeploy$\MyApp )

When I launch the app, it's ok it worked well. But on some other computer it does not work. I have this exception :

An error occurred creating the configuration section handler for MySection: Request failed.

The declaration of the section in the app.config file is :

  <configSections>
    <section name="MySection" type="MyGenerator.Config.MySection, MyGenerator"/>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="MySectionGenerator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
    </sectionGroup>
  </configSections>

Now the section :

<MySection>
  <Addresses>
    <add Name="1" Text="ADDRESS ONE"/>
    <add Name="2" Text="ADDRESS TWO"/>
    <add Name="3" Text="ADDRESS THREE"/>
    <add Name="4" Text="ADDRESS FOUR"/>
    <add Name="5" Text="ADDRESS FIVE"/>
    <add Name="6" Text="ADDRESS SIX"/>
    <add Name="7" Text="ADDRESS SEVEN"/>
  </Addresses>
</MySection>

NOTE : If I copy the executable and the config file on the local computer, it works fine.

Have you got an idea, a clue... ?

Florian
  • 4,507
  • 10
  • 53
  • 73
  • 1
    Could it be related to the exe being "blocked" because it's run from the network drive. As discussed here: http://stackoverflow.com/questions/13528862/why-does-using-configurationmanager-getsection-cause-securityexception-request – Mark Feb 03 '16 at 13:47
  • Only for few machines and not all ? – Florian Feb 03 '16 at 13:51
  • Maybe a difference in one or more security settings between the machines and/or user privileges? – Mark Feb 03 '16 at 14:00
  • You're right that's it ! I don't why but when I replace Section addressConfigSection = ConfigurationManager.GetSection("MySection") as MySection; by var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); MySection addressConfigSection = config.GetSection("MySection") as MySection; – Florian Feb 03 '16 at 15:13

1 Answers1

0

Check with allowExeDefinition=machinetoapplication option.

Britto Raj
  • 401
  • 1
  • 5
  • 15