0

I'm building a component that is an extension for another software product. It's loaded as a dll into that product, and therefore I don't have control over the main exe's app.config file. My component uses WCF and I'd like to be able to configure it using a .config file instead of programmatically within the code. Is there a way to tell WCF to get all the binding etc settings from a specific config file?

Rory
  • 40,559
  • 52
  • 175
  • 261
  • 1
    In brief: no. WCF uses .NET standard config system, and that config system doesn't support separate / custom / class-library level config's – marc_s Feb 08 '11 at 05:40
  • You can use a xml-file that looks like a config, but actually is just a text file that is compiled as a Resource. But there is a problem: you will have to parse values and create service in code. So it's no better. – vortexwolf Feb 08 '11 at 16:06

2 Answers2

1

The .NET config file mechanism is scoped by AppDomain, so in principle you could achieve this by creating a separate AppDomain to host your WCF stuff. It's quite a lot of work, though, as you would have to code the necessary cross-domain communication to expose your extension functionality to the host process.

Chris Dickson
  • 11,964
  • 1
  • 39
  • 60
0

Ultimately @marc_s's answer was the one I went with: no. Instead we store configuration options with other system settings and then apply them programmatically to the binding etc settings at runtime.

Rory
  • 40,559
  • 52
  • 175
  • 261