0

I want to separate out client endpoints in a different config file and I want to use that external config files in my main web.config. But I have one concern that my client.config file is not in the same project directory.

Eg.

  <client configSource="~\..\..\Client.config"></client> 

or

  <client configSource="D:\Client.config"></client>

I don't want to copy client.config in my project folder when I publish my project because when I change one of the client config then I have to copy client.config in all projects, those are using client config.

So How I can use client.config file in my main web.config?

Emmanuel DURIN
  • 4,803
  • 2
  • 28
  • 53
Girish
  • 427
  • 2
  • 6
  • 19
  • You might use `ConfigurationManager` class. Look at following posts : http://stackoverflow.com/q/28542432/5295797 http://stackoverflow.com/q/19589/5295797 – Emmanuel DURIN Nov 04 '15 at 15:52
  • Possible duplicate of [.NET Config Files configSource outside the application directory folder](http://stackoverflow.com/questions/569117/net-config-files-configsource-outside-the-application-directory-folder) – Emmanuel DURIN Nov 04 '15 at 15:54
  • 1
    @EmmanuelDURIN - This question is different. I don't want to copy file in my project folder. Different project may use same config so if I make some change in client config in production server then how it will reflect in all project? – Girish Nov 05 '15 at 04:09
  • So you want to read the Client.config file and from that reading create a service endpoint, correct ? – Emmanuel DURIN Nov 05 '15 at 08:31
  • @EmmanuelDURIN - Correct. – Girish Nov 05 '15 at 10:56
  • Sorry to bother, but don't you think it 's better that the client reads the server's config ? – Emmanuel DURIN Nov 05 '15 at 15:48
  • Because pretty often there are some behaviors to be defined on the serve. So an XML file is useful. And If there are many clients, it could be useful that they read from the server. – Emmanuel DURIN Nov 05 '15 at 15:50

0 Answers0