WCF - Reading from Application Configuration File - config section - system.serviceModel

I can't find any example on the web for this, so i guess it could be helpful.
This is a simple example to show a way to read the system.serviceModel configuration section in application/web configuration file.

Something like for
ConnectionString, there is a straightforward class for that,

Codes snippet below

ServiceModelSectionGroup group = ServiceModelSectionGroup.GetSectionGroup(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None));

//suppose if there is only one endpoint
if(group.Client.Endpoints.Count < 0)
uri = group.Client.Endpoints[0].Address.AbsoluteUri;


Popular posts from this blog

Clearcase check in/uncheck out all the checked out files script

Duplicating a local copy of project from TFS and making web software client factory to work