In the computer room charge system has been applied to the configuration file, at that time also a use of the configuration file is not very thorough understanding of the following to summarize some of the operation of the configuration file.
What is a configuration file
This is used to save some of the configuration information in the project, especially the configuration information that needs to be changed later. For example, the operation of the database connection, changes, the direct modification can be. When the ASP . NET site IIS starts, the configuration information in the configuration file is loaded, and the information is cached, and the configuration file information is monitored during the run, and the changes are re-read and cached.
Why should I use a configuration file?
This involves the operation mechanism of ASP .
ASP --DLL file--JIT processing--Local machine code--cache
The above procedure is that the ASP . NET page will be compiled into a DLLwhen the first request is made. The file, executed by JIT programming cost code, and caches the local machine code. Therefore, the first time the ASPX page is opened, it will be slower, and then directly invoke the cache when executing.
It is because of this that the. config file escaped from this, and when the Web application is published , it is not compiled into the DLL file. If the client changes in the future, modify the Web. config file directly with Notepad and you can run it again. From this we can look at the Web. config file's benefits of saving change configuration information.
To mention a little more here, from the above-mentioned ASP . NET execution mechanism, the browser will only execute machine code, all . ASPX files will be converted to machine code, so if the performance of the site optimization, you can use static Web pages, such as HTML , because it will improve the performance of the site, reduce the time to compile.
Read priority (Nearest principle) now the current page is looking for the Web. config file under the directory, and the presence stops
Locate the Web. config file in the root directory of the current Web site and stop if it exists
Locate the Web. config file in the software installation path, stop if it exists
Asp. NET configuration Files