Web.config
file
- web.config is used for ASP.NET Web Projects / Web Services. web.config by default has several configurations required for the web application. It is also called Application Level Configuration File and inherits setting from the machine.config file.
- web.config is parsed at runtime, so if you edit the web.config file, the web application will automatically load the changes in the config file.
- web.config file is automatically generated when new web application created.
- You can have more than one web.config file in your application. Specifically, you can have a web.config for each folder under your web application.
- The web.config file is required for ASP.NET webpages.
- You can store information like connections strings, domains, application properties,session information, Cookie information,Viewstate information etc in web.config file.
App.config
file
- app.config is used for Windows Forms, Windows Services, Console Apps and WPF applications.
- app.config is parsed at compile time, so if you edit the app.config file, you have to restart the application. At compile time a copy of the app.config file is taken, renamed to [output].config and moved to the build folder. This copy can then be modified, and your modifications will be read each time the application/service is started.
- app.config is not added automatically to an application. You can go to the solution explorer, select 'Add new item' and add the 'Application Configuration File'.
- There is always one app.config file in a window application.
- The app.config file is optional in an application and doesn't have to be used when writing desktop applications.
Machine.config file
- machine.config file is automatically installed on your system when you install Visual Studio.Net. This is also called Machine Level Configuration File.
- Only one machine.config file exists on a server, and is at the highest level in the configuration hierarchy.
- The settings of machine.config file are applied to all the web applications residing on the server.
- The machine.config file is overridden by the web.config file.
- Without the machine.config file, application can not be executed.
- It is a global settings file for all the applications that run on the .Net Framework on the machin.
No comments:
Post a Comment