I have a windows service that uses a plugin system. I use the following code in the plugin base class to provide a separate configuration for each DLL (so it will read from plugin.dll.config):
string dllPath = Assembly.GetCallingAssembly().Location;
return ConfigurationManager.OpenExeConfiguration(dllPath);
These plugins should make calls for WCF services, so the problem I encountered is that it new ChannelFactory<>("endPointName")only scans the hosted App.config application for endpoint configuration.
Is there a way to just pass ChannelFactory to search in another configuration file or somehow enter my object Configuration?
The only way I can come up with is to manually create an EndPoint and Binding object from the values ββread from plugin.dll.config, and pass them to one of the overloads ChannelFactory<>. It really looks like a recreation of the wheel, though, and it can get very messy with endPoint, which makes heavy use of behavior and configuration bindings. Perhaps there is a way to easily create EndPoint and Binding objects by passing it a configuration section?
source
share