web.config中有多个外部文件?

时间:2011-03-19 05:37:24

标签: .net iis-7 web-config

我需要做这样的事情:

<appSettings>
  <add key="Three" value="NumberThree"/>    
</appSettings>
<appSettings configSource="One.config"/>
<appSettings configSource="Two.config"/>

这给了我一个错误:Sections must only appear once per config file.

有点糟糕:(只是想知道:有没有办法/设置我可以做这样的事情?(IIS7,.net 3.5SP1)

我几乎无法控制web.config,也无法修改现有的appSettings元素,只能添加新项目。

2 个答案:

答案 0 :(得分:1)

配置具有设置的继承层次结构。

结帐ASP.NET Configuration File Hierarchy and Inheritance

编辑:另一个: How to: Configure Specific Directories Using Location Settings

答案 1 :(得分:-1)

不确定这是否对您的特定情况有所帮助。 查看file

上的<appSettings>属性
<appSettings file="Two.config">
  ...
</appSettings>

Two.config中,您可以执行相同操作以指向One.config

相关问题