【发布时间】:2013-08-26 19:20:20
【问题描述】:
我的 web.config 如下所示:
<configuration>
<configSections>
<appSettings configSource="Exampleapp.config" />
<connectionStrings configSource="ExampleProd.config" />
</configSections>
<configuration>
我的 app.config (Exampleapp.config) 如下所示:
<configSections>
<sectionGroup name="exampleSettings">
<section name="blah" type="System.Configuration.NameValueSectionHandler" />
<section name="foo" type="System.Configuration.NameValueSectionHandler" />
</sectionGroup>
</configSections>
<exampleSettings>
<blah>
<add key="me" value="1" />
</blah>
<foo>
<add key="you" value="2" />
</foo>
</exampleSettings>
我收到一条错误消息:XML 文档不能包含多个根级元素。我该如何解决这个问题?
【问题讨论】:
-
为什么没有
<configuration>作为根? -
@Nilesh 如果我进行配置,则会收到一条错误消息:configSource 文件的格式必须是包含该部分名称的元素。
标签: asp.net web-config app-config