Как я могу программно обнаружить текущие конечные точки моего приложения C #?

Как я могу написать пример кода c # для чтения конфигураций конечных точек моего клиента:

<client>
   <endpoint address="http://mycoolserver/FinancialService.svc"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFinancialService"
      contract="IFinancialService" name="WSHttpBinding_IFinancialService">
      <identity>
         <dns value="localhost" />
      </identity>
   </endpoint>
   <endpoint address="http://mycoolserver/HumanResourcesService.svc"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHumanResourceService"
      contract="IHumanResourceService" name="WSHttpBinding_IHumanResourceService">
      <identity>
         <dns value="localhost" />
      </identity>
   </endpoint>

И цель состоит в том, чтобы получить массив адресов конечных точек:

List<string> addresses = GetMyCurrentEndpoints();

В результате мы будем иметь:

[0] http://mycoolserver/FinancialService.svc  
[1] http://mycoolserver/HumanResourcesService.svc
12
задан Rob Hruska 5 May 2012 в 16:18
поделиться