Why do WCF clients depend on the app.config file?

Posted by routeNpingme on Stack Overflow See other posts from Stack Overflow or by routeNpingme
Published on 2010-03-16T22:39:30Z Indexed on 2010/03/16 22:41 UTC
Read the original article Hit count: 245

Filed under:
|
|
|

Like a lot of things, I'm sure there's a good reason for this, so please help me understand...

Why, by default, do WCF services store settings in app.config?

This has been so frustrating trying to work with multiple Silverlight class libraries. These class libraries are supposed to be completely independent from each other, and this dependency on the app.config seems to cause the following headaches:

  1. Single Responsibility Principle - I should be able to add a reference to a class library and go. If that class library uses a service reference, this idea is shot before I even start coding against it.
  2. Muddy Configuration - To get other libraries to work, I have to copy and paste the service configurations into the "main" application configs. If an endpoint changes in any way, I can't just worry about a new version of that class DLL - I have to worry about anything that uses it, too.
  3. Complex Alternatives - Programmatically creating the endpoint isn't pretty. Period.

There has to be a better way. Why doesn't WCF at least separate the service configurations into a ServiceName.config or something that gets copied to an output directory. What am I missing? How do you deal with this?

© Stack Overflow or respective owner

Related posts about .net-3.5

Related posts about wcf