Just blogging

  • Override WCF client settings for custom config file using DuplexChannel

    WCF config files are a great thing, once you have everything configured you just need 2 or 3 lines of code and everything get parsed and you are able to consume the service. By default WCF configuration is stored in the app.config or web.config of the main application, but sometimes (as was my case) the client is in-process of another unknown application, if so the WCF config file will have to be named SomeApp.exe.config and would need to be placed in the same folder as the application. Dealing with this can make things difficult, this is when you have to create your own ChannelFactory, this way you can provide your own config file. The solution I found after doing some goggling was to inherit from ChannelFactory and the pass the config file to the constructor