Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF list all client endpoints that implement a certain contract

Tags:

wcf

Is there a way to list all the WCF client endpoints in an application config file?

I need to establish multiple client connections to different servers and want to find a way to still maintain all the client connection information in the application config file.

like image 270
sipsorcery Avatar asked Jan 17 '10 10:01

sipsorcery


1 Answers

Try this:

// using System.ServiceModel.Configuration;
ServiceModelSectionGroup serviceModelSectionGroup =
    ServiceModelSectionGroup.GetSectionGroup(
        ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None));
foreach (ServiceElement serviceElement in
    serviceModelSectionGroup.Services.Services.OfType<ServiceElement>())
{
    // do stuff
}
like image 121
Rubens Farias Avatar answered Oct 27 '22 12:10

Rubens Farias