Difference between Web.Config and Machine.Config File

Two types of configuration files supported by ASP.Net.

Configuration files are used to control and manage the behavior of a web application.

i) Machine.config

The Machine.Config file, which specifies the settings that are global to a particular machine. There must be one Machine.config in one computer.This file is located at the following path:

    \WINNT\Microsoft.NET\Framework\[Framework Version]\CONFIG\machine.config

As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications. 

You can override settings in the Machine.Config file for all the applications in a particular Web site by placing a Web.Config file in the root directory of the Web site as follows:  

  \InetPub\wwwroot\Web.Config


ii)Web.config

It is an optional XML File which stores configuration details for a specific asp.net web application. 

You can use the <location> tag to lock configuration settings in the Web.Config file so that they cannot be overridden by a Web.Config file located below it. You can use the allowOverride attribute to lock configuration settings. This attribute is especially valuable if you are hosting untrusted applications on your server.

 

 When you modify the settings in the Web.Config file, you do not need to restart the Web service for the modifications to take effect..  By default, the Web.Config file applies to all the pages in the current directory and its subdirectories. 

Difference between Machine.Config and Web.Config


Machine.Config:
i)  This is automatically installed when you install Visual Studio. Net.
ii) This is also called machine level configuration file.
iii)Only one machine.config file exists on a server.
iv) This file is at the highest level in the configuration hierarchy.

Web.Config:
i)  This is automatically created when you create an ASP.Net web application project.
ii) This is also called application level configuration file.

iii)This file inherits setting from the machine.config 

转载于:https://www.cnblogs.com/xiaochuncha/archive/2009/12/22/1629899.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值