WCF configuration from string or XML fragment

ServiceModelSectionGroup serviceModel = ServiceModelSectionGroup.GetSectionGroup(appConfig);

In view of the above, it is possible to get the ServiceModelSectionGroup from the string/xml in memory anyway. Is it not obtained from a configuration object or file?

Depending on whether you can create temporary files, this article provides a potential solution:

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

” I will build a custom channel factory-from ChannelFactory-read its WCF client configuration from a custom configuration file. Then I will insert this channel factory into the proxy generated by Visual Studio.NET.”

and…

“The non-virtual members and constructors of certain classes in the ChannelFactory hierarchy use the System.Configuration namespace to resolve addresses, bindings, and contract information. The classes in this namespace are dedicated to Read the configuration section à laapp.config from the physical XML configuration file. These classes need a file path to complete their work. So there is no way to bypass the configuration file-at least a temporary file. “

< /p>

ServiceModelSectionGroup serviceModel = ServiceModelSectionGroup.GetSectionGroup(appConfig);

In light of the above, it is possible anyway to get the ServiceModelSectionGroup from the string/xml in memory instead of the configuration object or From the file?

Depending on whether you can create temporary files, this article provides a potential solution:

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

“I will build a custom channel factory – from ChannelFactory- Read its WCF client configuration from a custom configuration file. Then I insert this channel factory into the proxy generated by Visual Studio.NET. “

and…

“ChannelFactory The non-virtual members and constructors of certain classes in the hierarchy use the System.Configuration namespace to resolve address, binding and contract information. The classes in this namespace are specifically used to read the configuration section à laapp from the physical XML configuration file. config. These classes need a file path to complete their work. So there is no way to bypass the configuration file-at least a temporary file. “

Leave a Comment

Your email address will not be published.