configSource 在 system.serviceModel * 或 * 其子部分中不起作用 [英] configSource doesn't work in system.serviceModel *or* its subsections
问题描述
我正在尝试将 app.config 文件拆分为多个文件,以便更轻松地管理不同环境所需的差异.有一些部分很容易...
I'm trying to split an app.config file into multiple files to make it easier to manage the differences needed for different environments. With some sections it was easy...
<system.diagnostics>
various stuff
</system.diagnostics>
变成了
<system.diagnostics configSource="ConfigFilessystem.diagnostics.dev" />
将各种内容"移至 system.diagnostics.dev 文件.
with the "various stuff" moved to the system.diagnostics.dev file.
但是对于 system.serviceModel
部分,这似乎不起作用.
But for the system.serviceModel
section this doesn't seem to work.
现在我读过一些建议,它不适用于 system.serviceModel
本身,但它适用于它下面的部分:bindings
, client
、diagnostics
等.但是当我尝试将 configSource 与其中之一一起使用时,同样的事情发生在我身上.当我输入
Now I've read suggestions that it doesn't work for system.serviceModel
itself, but it works for the sections underneath it: bindings
, client
, diagnostics
, etc. But the same thing happens to me when I try to use configSource with one of them. When I put in
<system.serviceModel>
<bindings configSource="ConfigFileswhateverFile.dev" />
我明白了:
未声明configSource"属性.
有没有其他人看过这个?你知道解决办法吗?(也许我有一个过时的架构或什么?)
Has anyone else seen this? Do you know a solution? (Perhaps I have an out-of-date schema or something?)
推荐答案
VS.NET 的编辑器抱怨配置,但它有效.
VS.NET's editor moans about the config, but it works.
我有这样的配置...
<system.serviceModel>
<behaviors configSource="configsystem.servicemodel.behaviors.config" />
<bindings configSource="configsystem.servicemodel.bindings.config" />
<client configSource="configsystem.servicemodel.client.config" />
</system.serviceModel>
...效果很好.
这篇关于configSource 在 system.serviceModel * 或 * 其子部分中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!