Loading config file with ConfigurationManager.OpenExeConfiguration
I am in a pretty strange situation here.
I've written a DLL for a customer and i am near the end of the development cycle. I just need to be able to load the dll.config and I am done. This is easy for a winform app. all I had to do was to place mylib.dll.config in the bin folder of the winform app and I am done, and ConfigurationManager.OpenExeConfiguration("mylib.dll") will just pick up the config content. But our custom consumes the library via a web app, worst yet, it's a classic asp app and my DLL is compiled as COM. I tried placing the config file in the root folder of the开发者_JAVA技巧 web app, and also its bin app, but I got an exception both times. It appears that the executing path for a web app is not really in the web folder.
Point me to the right direction please?
edit: this is the exception I get:
An error occurred loading a configuration file: The parameter 'exePath' is invalid. Parameter name: exePath
Needed to use OpenMappedExeConfiguration instead:
http://blog.rodhowarth.com/2009/07/how-to-use-appconfig-file-in-dll-plugin.html
精彩评论