Posted By

ed_trench on 11/07/12


Tagged


Versions (?)

Get Web Services Server Names (app.config exe)


 / Published in: Visual Basic
 

Gets a list of web service server names from app.config

  1. Private Function GetWebServicesServerNames() As String
  2.  
  3. Dim serverNames As New StringBuilder
  4. Dim appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
  5. Dim serviceModel = ServiceModelSectionGroup.GetSectionGroup(appConfig)
  6. Dim bindings = serviceModel.Bindings
  7. Dim endpoints = serviceModel.Client.Endpoints
  8.  
  9. For i = 0 To endpoints.Count() - 1
  10. Dim endpointElement = endpoints(i)
  11. serverNames.AppendLine(endpointElement.Address.Host)
  12. Next
  13.  
  14. Return serverNames.ToString()
  15.  
  16. End Function

Report this snippet  

You need to login to post a comment.