5

I've been trying to find a way to load my WCF service configuration (that huge BLOB of XML config data) from an alternate source - not the standard web.config / app.config.

We're running in a restricted environment where we don't have access to the server's file system, and thus we cannot make tweaks and changes to our WCF configs ourselves - we always have to find IT managers to handle that. We've put our entire configuration into a sQL Server database and trimmed down the web.config basically to a section - that's it.

Now, we were wondering if there's a nice, documented way to do the same for WCF - is there a mechanism to plug in a "config provider" of sorts? Could we somehow store our config entries in a database table and feed them to the services as they start up?

I haven't been able to find any really useful and understandable documentation and samples on this..... any takers here?!?!

John Saunders
  • 160,644
  • 26
  • 247
  • 397
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • So you basically want to be able to configure your endpoints and behaviors via edits to the configuration that would be dynamically loaded when a request comes in? I guess you want to be able to change them via some sort of user interface which allows edits to this stored configuration? – Ta01 Nov 24 '08 at 20:17
  • Well, not even really dynamically - I would just like to store the whole WCF config that a service uses when starting up, or that a client uses when finding out how to connect to a service, somewhere else than the usual default XML config files. Things like binding, address etc. – marc_s Dec 14 '08 at 19:25
  • 1
    Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). ;-) – John Saunders Nov 03 '13 at 18:17

1 Answers1

6

You can do this, it's a little bit of work though.

On the service side, You'll have to create your own custom ServiceHost and override the ApplyConfiguration method.

Check out this blog post

On the client side, you do something similar, but provide a custom ChannelFactory and override the ApplyConfiguration method there.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Stever B
  • 4,117
  • 2
  • 26
  • 18