Get Web Services Server Names (app.config exe)


/ Published in: Visual Basic
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.