Gatmando
Gatmando

Reputation: 2269

Get listing of web services referenced in WCF application?

Could anyone out there give some pointers on how to go about getting a listing of all the web service references used by a WCF application - the pseudo code I'm envisioning might look something like:

For each ws in MyWebServices Console.WriteLine("Service Name: " & ws.Name) Next

How to build the MyWebServices object is what I am wondering?

Thanks

Upvotes: 0

Views: 87

Answers (2)

Drew Marsh
Drew Marsh

Reputation: 33379

You should be able to do:

ClientSection clientSection = (ClientSection)ConfigurationManager.GetSection("system.serviceModel/client");

foreach(ChannelEndpointElement channelEndpointElement in clientSection.Endpoints)
{
    // Use any of the channel endpoint element properties here:
    // Address, BehaviorConfiguration, Binding, BindingConfiguration, Contract, etc.
}

Upvotes: 2

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65371

You could just check the configuration file. All WCF services used by the application should be in the client section.

Upvotes: 0

Related Questions