Wednesday 15 February 2012

.net - How to store custom settings for a WCF service? -


  1. People say libraries should not be a configuration file.
  2. I can not pass arguments with my host of its WCF service class (but I can do it with the customer).
  3. I do not want to store the configuration on the client.
  4. What should I do?

What are you asking? Are you talking about the settings for the service (server side), or the client?

Why can not you just use the client-side config file as if you do for other apps? This is the underlying, preferred way of doing things - why not use it ??

Then: What exactly are you asking for? Or what's the problem, are you trying to solve, actually?

  • For a service (server side): Store your binding, behavior, service endpoint etc. Web.config (if hosting in IIS) or your service host (if the NT service Or console app) then

  • For the client: Store your configuration The main app's app. If you want, configure the "client.config" and "bindings.config" files you can provide, and then just simply

      & lt; System.serviceModel & gt; & Lt; Bindings configSource = "bindings.config" /> & Lt; Client configSource = "client.config" / & gt; & Lt; /system.serviceModel>  

Your Client App's App In fact - in fact, this is not so much easier!


No comments:

Post a Comment