Configuration


Configuration refers to any settings or data required by an application to run. This data can be as simple as the connection string used to connect to a database, or as complex as the number of threads the running process might require. ASP.NET’s configuration system is XML file–based. Many first-time ASP.NET developers expect to configure ASP.NET using the Internet Information Services Manager, much as they would with classic ASP. ASP.NET does not, however, rely upon the IIS metabase. The ASP.NET configuration system requires no proprietary tools to update or manage its configuration system since an XML-based configuration system easily lends itself to manual editing and updating.

  • You will find that you might have more than one machine.config on your computer. The .NET Framework is designed to allow multiple versions to run side by side. Each version has its own separate machine.config file. The version of the .NET Framework your Web application is using is determined by the extension mappings, for example, .ASPX, in Internet Information Server. Be sure you edit the correct machine.config if you want to change global settings.

  • You can change mappings to allow your application to use a different version of the .NET Framework with the aspnet_regiis.exe tool. This tool is found in the version-specific directory Windows\Microsoft.NET\Framework\[Version]\.

  • Don’t modify the machine.config file unless you absolutely have to. Changes to machine.config affect the entire server. Instead use web.config in your application to specify desired behavior and configuration options.

  • An easy way to tell whether you are working with a root directory for either a Web site or Web application is to look for a \bin subdirectory. The \bin subdirectory is allowed only in the root directory of a Web site or Web application.

  • When updating a live site, perform all web.config changes locally and upload the running site with the new copy. This is much more efficient than changing and saving multiple times on the live web.config file.

  • Customers often ask us whether they should store data in web.config or global.asax. We recommend you store data within configuration. Storing settings in files such as global.asax implies code. The configuration file allows you to make simple changes without having to recompile your application. Simply add the settings and update the web.config file on your running server.




Microsoft ASP. NET Coding Strategies with the Microsoft ASP. NET Team
Microsoft ASP.NET Coding Strategies with the Microsoft ASP.NET Team (Pro-Developer)
ISBN: 073561900X
EAN: 2147483647
Year: 2005
Pages: 144

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net