How does ASP.NET compile config files, such as web

2019-07-08 09:05发布

In reading this question, I asked in one of the answers the following:

This answer implies that ASP.NET reads web.config and other config files from the top, ie: top-down. I thought config files were read as a "single instance" meaning that the compiler first parses the config file for accuracy and then compiles it, but it seems to be compiling it on the fly - line by line.

Is that true?

How does ASP.NET deal with config files? Is there a link someone could share with me the order of processing config files in ASP.NET?

1条回答
混吃等死
2楼-- · 2019-07-08 09:44

.NET does not ever compile config files.

They are XML files. The files for the virtual path are read in, and machine.config is treated as though it were the highest in the tree. The files are merged, then processed. Elements from lower levels override elements in higher levels (unless the higher-level element prevents overriding).

See "ASP.NET Configuration File Hierarchy and Inheritance".

查看更多
登录 后发表回答