I have a WCF service that calls into a DLL. The service has a web.config and the DLL has an app.config. I've written a custom app config section thanks to this question for the DLL. However, in the DLL when I make a call to ConfigurationManager.GetSection("...")
it tries to read from the service's web.config.
How can I set it up so that the DLL reads from it's app.config while the service reads from it's web.config?
EDIT: It seems that when my I debug my service, my DLL gets copied to a strange temp folder (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f4d2cdd1\a59eb1c1\assembly\dl3\7c7f438f\b42518b4_f8f2cf01) but my DLL's config does not. If I copy the config there by hand, I can use OpenMappedExeConfiguration
to read it. A regular call to ConfigurationManager
continues to read the web.config even if the app.config is present.
I can't move the config settings from the app.config to the web.config because this DLL is shared between a WCF service and a REST service. I want them coming to a single DLL that offers core functionality for both. The DLL should read it's own config file and not either of the web.configs so that there's no chance of one service getting different values than the other.