使用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
我在这个问题中提到了第二个答案(汤姆兄弟),它证明了我想要什么。
web.config 可以从外部 xml 文件中读取吗?
附加
这是该帖子的配置。有无效的蓝色波浪线。
<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 属性?