I have a self hosted C# WCF service which creates 20+ endpoints for various purposes. Each is configured in the code itself with a few basic config items in the app.config of the service such as port and address. The service works great for the tested clients, but has not been widely tested.
I was a little leary of the standard wcf config file approach because I was afraid the end user would mess things up and hence did everything in code.
Is it a better idea to do the configuration in the config file because then the end user could customize it to their needs or is the in code approach sufficient for most needs?
You need to ask yourself some questions
If the answer is yes to any of those questions then you need to move the settings into a .config file. If your worry is that clients who understand other settings are going to mess up your wcf settings on accident you can always separate settings by adding the configSource
attribute to your web.config or app.config file for each tag and put parts of your configuration in separate files in a sub-directory to reduce the likelihood of an accidental change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With