外部文件中使用VS2010Web.Config中,對於system.serviceModel
我在我的web.config以下(詳細移除)。
<system.serviceModel>
<behaviors />
<services />
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings />
<client />
</system.serviceModel>
我想用屬性configSource一樣的appSettings可以用它來獲取其它配置文件,這些元素的細節。
我試圖將configSource屬性應用於system.serviceModel或每個子節點。 不過,我得到無效的藍色wavvy行說:
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 attibute?
那麼,你不能將configSource應用到system.serviceModel,因爲它是一個配置節組。你是如何將configSource應用於底層節點的?你能否包含那些看起來像這樣我們可以看到生成錯誤的配置文件? – 2011-03-02 03:31:03
@David Hoerster:我還沒有成功或者(適用於底層節點)。鏈接的文章暗示它,但我無法實現它的工作。我調整了我的帖子以顯示該帖子的答案。 – 2011-03-02 04:09:17
是的,這確實是Visual Studio的失敗。所以如果你使用這個,你將不得不忍受VS中的永久警告。 – Abacus 2013-07-29 20:49:37