WCF lists all client endpoints that implement a specific contract

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

I need to establish several client connections on different servers and want to find a way to save all the client connection information in the application configuration file.

+4
source share
1 answer

Try the following:

// using System.ServiceModel.Configuration; ServiceModelSectionGroup serviceModelSectionGroup = ServiceModelSectionGroup.GetSectionGroup( ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None)); foreach (ServiceElement serviceElement in serviceModelSectionGroup.Services.Services.OfType<ServiceElement>()) { // do stuff } 
+11
source

All Articles