简体   繁体   中英

compilation of web.config file

I am reading the book Professional asp.net 2.0 published by Wrox , under the concept of asp.net compilation , chapter 3, page no. 98, they have written following lines:

Compilation process doesn't compile every type of web file. In fact, it compiles only the ASP.NET-specific file types & leaves out of the compilation process the following types of files:
- HTML files
- XML files
- XSD files
- web.config files
- text files

Then my question is that, what is the meaning of above lines?

  • is there really no need to compile web.config files?
  • if needs which compiler compiles these files (means .cs file compiled by c# compiler, .aspx file compiled by aspnet_compiler like this)
  • if it is not compiles, then how it gives compilation error when we make some mistakes in web.config file?

The web.config is a configuration file and can not be compiled, it is just copied to the web site at deployment.

The file is parsed when the web application starts.

All of the files above, are not compilable files. They are files that could be needed at runtime and thus, should be deployed with your project output.

In particular, web.config is the file that contains configuration for your website and it is loaded and interpreted by the ASP.NET runtime (and perhaps from your own compiled files)

HTML files are used to represent the contents of your website, XML files could be used as datastore for some kind of information and could be embedded inside your compiled files or required by your executables. TXT files, well, they are simple, human readable, files.

"•is there really no need to compile web.config files? "

Web.config is dependant to a certain degree on how the hosting server is been setup and configured, eg wcf settings, security, framework, debug, etc.

The only way therefore a compiler could "compile" the web.config would be to compile against the server.

This would mean then you would never be able to do even basic changes to a website without the need for a recompile.

Just to add a bit more. web.configs while not compiled on the client, BUT! they are checked by the server side at runtime when a change is detected. So you do get some feedback if you have made a mistake, although by then you've published and its a little late.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM