【发布时间】:2011-07-06 23:04:49
【问题描述】:
使用 VS2010
我的 web.config 中有以下内容(已删除详细信息)。
<system.serviceModel>
<behaviors />
<services />
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings />
<client />
</system.serviceModel>
我想使用与 appSettings 相同的属性 configSource 从另一个配置文件中获取这些元素的详细信息。
我尝试将 configSource 属性应用于 system.serviceModel 或每个子节点。 但是,我得到无效的蓝色波浪线:
The 'configSource' attribute is not allowed
我指的是这个问题中的第二个答案(汤姆兄弟),它展示了我想要什么。
Can a web.config read from an external xml file?
附加
这是该帖子的配置。有无效的蓝色波浪线。
<connectionStrings configSource="web\config\connectionStrings.config" />
<appSettings configSource="web\config\appSettings.config" />
<system.diagnostics configSource="web\config\diagnostics.config" />
<system.serviceModel>
<bindings configSource="web\config\serviceModelBindings.config" />
<behaviors configSource="web\config\serviceModelBehaviors.config" />
<services configSource="web\config\serviceModelServices.config" />
<client configSource="web\config\serviceModelClient.config" />
</system.serviceModel>
在这种情况下如何使用 configSource 属性?
【问题讨论】:
-
好吧,你不能将 configSource 应用到 system.serviceModel 因为它是一个配置节组。你是如何将 configSource 应用到底层节点的?您能否将其包含在内,以便我们查看生成错误的配置文件?
-
@David Hoerster:我也没有成功(应用于底层节点)。链接的文章建议它,虽然我不能让它工作。我已经调整了我的帖子以显示该帖子的答案。
-
是的,这确实是 Visual Studio 的失败。因此,如果您使用它,您将不得不忍受 VS 中的永久警告。
标签: c# web-config app-config configurationmanager