当请求访问Web.Config时会被锁定

时间:2014-02-13 06:13:24

标签: asp.net

当请求访问它时,应用程序的web.Config将被锁定。其他请求是否需要在队列中等待?直到处理前的请求被处理?

什么是通用流程..如果两个资源同时访问Web.Config中的对象将会发生什么?

1 个答案:

答案 0 :(得分:0)

How to: Lock ASP.NET Configuration Settings

You can lock configuration settings in ASP.NET configuration files (Web.config files) 
by adding an allowOverride attribute to a location element and setting the
allowOverride attribute to false. Then within the location element, you 
can define the configuration section that you want to lock. ASP.NET will 
throw an exception if another configuration file attempts to override any 
configuration section that is defined within this locked location element.

<configuration>
  <location path="application1" allowOverride="false">
    <system.web>
      <trust level="High" />
    </system.web>
  </location>

  <location path="application2" allowOverride="false">
    <system.web>
      <trust level="Medium" />
    </system.web>
  </location>
</configuration>