I use the app.config file to store the dynamic parameters of my application. The problem is that when I change the value in the app.config file and run the application, it does not load the new value from the configuration file. It looks like the values ββin the app.config file are only read and inserted into the exe file at compile time!
This is how I read the configuration file:
public class Helper { static Helper() { Foo = ConfigurationManager.AppSettings["Foo"]; } public static string Foo { get; set; } }
Did I miss something?
Are you sure you changed the correct file? You do not want to modify the app.config file, but the file is <exename>.exe.configin the same directory as .exe
<exename>.exe.config
app.config - , ide, <exename>.exe.config ..exe , .config, .
. , :
public static class Helper { public static string Foo { get { return ConfigurationManager.AppSettings["Foo"]; } } }
, , , ConfigurationManager.AppSettings["Foo"] () - , .
ConfigurationManager.AppSettings["Foo"]
IISReset?
, Microsoft.NET,
WINDOWS\Microsoft.NET\Framework\vXXXXX\Temporary ASP.NET Files.
.
Source: https://habr.com/ru/post/1725834/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1725829/git-view-latest-log-message-for-specific-file-in-remote-repository&usg=ALkJrhgcnVfJAdIVWhbaFpoPAfRaHMhjxgChoosing between multiple devices in Xcode - iphoneOptimization to divide by "extern const int" - optimizationAccurate timing with PC oscilloscopes - embeddedDjango model ON DELETE CASCADE, emulate ON DELETE RESTRICT instead, the general solution is pythonDjango inlineformsetfactory - why is this useful? - djangoSystem.Threading.ThreadAbortException error without response. - asp.netConfiguring Rational Functional Tester (RFT) to run in Hudson / Jenkins - installationclojure namespace - clojureSilverlight tests fail until RDP connection opens - silverlightAll Articles