Freigeben über


Reading Configuration from a Repository

Can I use a centralized configuration repository in a distributed WCF application?

Yes, configuration is something that’s abstracted from the service or client logic in WCF although replacing the implementation behind that abstraction can be quite a bit of work. The System.Configuration system that drives the default file-based configuration system is hard to reuse on a piecemeal basis so making small changes to how configuration works can sometimes cost as much as large changes.

Replacing configuration settings after they’re loaded is fairly straightforward but this doesn’t work in all cases as you sometimes need to replace the initially loaded value or have an entirely separate notion of what configuration means.

One example of significantly altering how configuration works in a distributed application is demonstrated by the StockTrader sample that I mentioned last year. There have been several minor updates since then. You can get the latest version to see what has changed as well as a description of the included configuration service.

The configuration service sample is probably more complex than something that you’d want to directly copy into your application unless you’re looking for a configuration system that works in exactly the same way. There are many different patterns for configuring a distributed application demonstrated by the configuration service though so you might want to flip through the source code and included documentation for inspiration.