AppDomain & finding assemblies [.NET 2.0]

  • Thread starter Alexander van Doormalen
  • Start date
A

Alexander van Doormalen

I have a windows service which calls extensions. In 1 of those
extensions I want to load a config file (extension.dll.config). In that
config file I defined some ConfigurationSection's. For example:

<section name="somename" type="sonenamespace.someclassname,
someassembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>

The loading part is done using
ConfigurationManager.OpenMappedExeConfiguration(ExeConfigurationFileMap,
ConfigurationUserLevel). So far so good.

Then from the Configuration instance I get, I want to get a
ConfigurationSection using the GetSection method. Now I get an error
saying it cannot find the assembly that contains the class which
represents this section.

I think this is because

1) The service (host), which created a seperate appdomain to load the
extensions in, is located in <installdir>\Bin\service.exe
2) The extensions are located in a dir <installdir>\Extensions.

You see this is 1 dir up and. If I copy the extension to the bin
directory where the service.exe is located everything can be found
perfectly. But this is not what I want and not how this product works
(its Microsoft MIIS btw.)

Anybody has some ideas how to get this to work. I played a bit with the
assemblyBinding config element but never got it to work. Probably
because you can't got outside the base dir (which is where the
service.exe is located).

I hope someone can help me with this because I'm pulling hears right
now.
 
A

Alexander van Doormalen

Sorry that I reply so late. Never got the time to reinvestigate this.

Anyways... I tried the codebase solution only I can't get this to work
at all. When I add the runtime section to my app.config .NET can't find
my custom sections anymore. Maybe this is because I load the config
dynamically within the assembly. Normally a app.config is loaded by the
framework on startup.

I 'solved' the problem a while ago dough, by adding the assembly to the
GAC. Only this isn't a very neat way of doing this.
 

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