Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
375 views
in Technique[技术] by (71.8m points)

c# - configSource doesn't work in system.serviceModel *or* its subsections

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>

became

<system.diagnostics configSource="ConfigFilessystem.diagnostics.dev" />

with the "various stuff" moved to the system.diagnostics.dev file.

But for the system.serviceModel section this doesn't seem to work.

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" />

I get:

The 'configSource' attribute is not declared.

Has anyone else seen this? Do you know a solution? (Perhaps I have an out-of-date schema or something?)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

VS.NET's editor moans about the config, but it works.

I have config like this...

<system.serviceModel>
  <behaviors configSource="configsystem.servicemodel.behaviors.config" />
  <bindings configSource="configsystem.servicemodel.bindings.config" />
  <client configSource="configsystem.servicemodel.client.config" />
</system.serviceModel>

... which works fine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...