Reading from specific configuration file
I have an application that contain one exe file and several dlls. In one of the classes in my dll file I use ConfigurationManager.OpenExeConfiguration
to read settings that declare in the main exe file. but when I change the values of sections manually in the file it always return the initial value that I set at the开发者_高级运维 first time.
please tell me what I must do for reading settings from a specific config file in my application.
here's my applicationSettings:
<applicationSettings>
<UltraData.Bonus.BonusControler.Properties.Settings>
<setting name="ProviderName" serializeAs="String">
<value>WebProvider</value>
</setting>
</UltraData.Bonus.BonusControler.Properties.Settings>
</applicationSettings>
and I want to read ProviderName
value.
The app.config
file is the only one that is read. There are no .config
files for DLLs.
You do need to restart the application in order for the config to be re-read.
I find out where is my mistake. I must use <appSettings>
instead of <applicationSettings>
and read those settings by using ConfigurationManager.AppSettings["ProviderName"]
精彩评论