Welcome Guest Search | Active Topics | Members | Log In | Register

Configuration Section not loading with dynamically loaded Assembly Options · View
Paul Buckley
Posted: Tuesday, January 01, 2008 11:05:34 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 01/01/2008 23:05:34
Date: Wed, 2 Jan 2008 07:05:34 -0800 (PST)

Hi,

I'm trying to gain access to a configuration section from within an
assembly that has been loaded using Assemly.Load(byte[]).

There is one main exe (lets say myApp.exe) and one config file
(myApp.exe.config) which contains the config section. The dll
(myAssembly.dll) is a "plugin" and loaded on request. The reason we
use the byte array version of Assembly.Load is that the dll can remain
unlocked which allows us to overwrite it (and update the plugin with a
new version via a file watcher without taking down the service).

I have tried
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
and also the same method but passing in a full path to the config
file. Both return a Configuration object that does not contain my
custom config section so a call to GetSection returns null.

If we load the Assembly using Assembly.Load(string) then everything
works perfectly, but the Assembly file is locked and can't be updated.

Can anyone help me with why these two Load methods result in such
different behaviour, and what the solution might be to get round it?

Currently I am just using "AppSettings" but this is not as clean as
having individual config sections.

Thanks!
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.1 (NET v2.0) - 9/10/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.031 seconds.