代码之家  ›  专栏  ›  技术社区  ›  Ben McCormack

以编程方式编辑web服务的端点

  •  4
  • Ben McCormack  · 技术社区  · 16 年前

    有没有一种方法可以通过编程更改 <endpoint address="..." /> web服务的价值?在我的应用程序配置文件,我有以下代码:

    <system.serviceModel>
       <bindings>
           ...
       </bindings>
       <client>
         <endpoint address="http://dev.remotedomain.com/WebServices/WebService.asmx"
             binding="basicHttpBinding" bindingConfiguration="InboxServiceSoap"
             contract="InboxServiceSoap"
             name="InboxServiceSoap" />
       </client>
    </system.serviceModel>
    

    我想改变

    address="http://dev.remotedomain.com/WebServices/WebService.asmx"
    

    address="http://mymachine/WebServices/WebService.asmx"
    

    在代码中。在.NET中按程序实现这一点吗?

    2 回复  |  直到 16 年前
        1
  •  4
  •   Hatch    16 年前

    您可以使用类似以下的代码:

    作为新的xxxxx客户机的Dim服务