WCF configuration from string or xml fragment

ServiceModelSectionGroup serviceModel = ServiceModelSectionGroup.GetSectionGroup(appConfig); 

Given the above, is it possible to get a ServiceModelSectionGroup from a / xml line in memory and NOT from a configuration object or file?

+4
source share
1 answer

Depending on whether you can create a temporary file, this article offers a potential solution:

http://blogs.u2u.be/diederik/post/2010/07/29/Get-your-WCF-client-configuration-from-anywhere.aspx

"I will create my own factory channel, obtained from ChannelFactory, which reads the configuration of my WCF client from the user configuration file. Then I connect this factory channel to the proxy server that was generated by Visual Studio .NET."

A...

β€œSome of the non-virtual members and class constructors in the ChannelFactory hierarchy use the System.Configuration namespace to analyze address, binding, and contract information. The classes in this namespace specialize in reading configuration sections from the physical XML configuration files Γ  la app.config. For These classes require a file path to do their job, so there is no way to create a configuration file - at least temporary.

+1
source

All Articles