ConfigurationManager.AppSettings Caching

前端 未结 6 2233
北恋
北恋 2020-12-29 20:13

We know that IIS caches ConfigurationManager.AppSettings so it reads the disk only once until the web.config is changed. This is done for performance purposes.

Someo

6条回答
  •  庸人自扰
    2020-12-29 20:32

    It reads the application configuration file (MyApp.exe.config) once at application startup, as can easily be verified by changing the file while the app is running.

    The comment in the forum post referenced by the OP was:

    The values for the Web.config are stored into cache/memory when the application starts hence why the app restarts when any changes are made to the web.config. Note that this only applies to the Web.config, any other .config files you may use are accessed from the disk by default

    I would interpret this comment as meaning that config files other than web.config in an ASP.NET application are accessed from the disk by default. And similarly, config files other than MyApp.exe.config in a WinForms/Console application are accessed from the disk by default.

    This comment is not stating that MyApp.exe.config is read from the disk by default.

提交回复
热议问题