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 li开发者_如何学Goke 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?
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.
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.
精彩评论