Chapter 9. Configuration
Introduction
ASP.NET provides a convenient, extensible, XML-based mechanism for
configuring ASP.NET and applications that run under it. It is a great
improvement over the IIS metabase that was awkward to change,
required IIS to be restarted, and was not easily replicated on
additional servers. By contrast, ASP.NET automatically detects
changes to the web.config file and transparently
restarts the application; there is no need to restart IIS. And
replicating an ASP.NET application configuration is as simple as
copying the web.config file to the new server.
Configuration File Hierarchy
ASP.NET uses a hierarchy of
configuration files. The
machine.config file contains the settings for
the server and is located in the
%SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\
folder. You can create web.config files to
configure each of your applications, overriding the settings in
machine.config. When you create a new ASP.NET
web application project, Visual Studio .NET automatically creates a
web.config file for you in the root directory of
the application, which you can modify as required. Folders within the
application can also have web.config files to
customize the configuration of portions of the application.
Structure and Use of web.config
The basic structure of web.config has a format similar to machine.config. The idea is that you add to web.config only those entries for which you want to override settings in machine.config. At a minimum, web.config must ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access