Rory
Rory

Reputation: 41897

How to tell WCF client to read settings out of different config file?

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?

Upvotes: 0

Views: 434

Answers (2)

Rory
Rory

Reputation: 41897

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.

Upvotes: 0

Chris Dickson
Chris Dickson

Reputation: 12135

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.

Upvotes: 1

Related Questions