代码之家  ›  专栏  ›  技术社区  ›  Heinzi

web.config中的<location>标记是覆盖标记级别还是属性级别的设置?

  •  1
  • Heinzi  · 技术社区  · 5 年前

    特别是,如果我的web.config看起来像这样:

    <system.web>
      <httpRuntime requestValidationMode="2.0" maxRequestLength="20480" />
      ...
    </system.web>
    

    我想增加特定页面的执行超时时间 同时保留另一个 httpRuntime 如上所述的选项 ,写就够了吗

    <location path="Statistics.aspx">
      <system.web>
        <httpRuntime executionTimeout="180" />
      </system.web>
    </location>
    

    还是我需要写信

    <location path="Statistics.aspx">
      <system.web>
        <httpRuntime requestValidationMode="2.0" maxRequestLength="20480" executionTimeout="180" />
      </system.web>
    </location>
    

    我有 read the documentation ,但不幸的是,它没有涉及这一点。我知道后一种选择是最“安全”的,但我尽量坚持“不要重复自己”的原则。

    0 回复  |  直到 5 年前