开发者

Multiple external files in web.config?

开发者 https://www.devze.com 2023-02-18 07:09 出处:网络
I need to do something like this: 开发者_开发百科<appSettings> <add key=\"Three\" value=\"NumberThree\"/>

I need to do something like this:

开发者_开发百科
<appSettings>
  <add key="Three" value="NumberThree"/>    
</appSettings>
<appSettings configSource="One.config"/>
<appSettings configSource="Two.config"/>

This gives me an error: Sections must only appear once per config file.

That kinda sucks :( Just wondering: Is there any way/setting I can enable to do something like this? (IIS7, .net 3.5SP1)

I have very little control of the web.config and can't modify the existing appSettings element, only add new items.


Configurations have a set inheritance hierarchy.

Checkout ASP.NET Configuration File Hierarchy and Inheritance.

EDIT: Another one: How to: Configure Specific Directories Using Location Settings.


Not sure if this will help for you particular scenario. Have a look at the file attribute on <appSettings>

<appSettings file="Two.config">
  ...
</appSettings>

In Two.config you can then do the same to point to One.config

0

精彩评论

暂无评论...
验证码 换一张
取 消