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

.net 以编程方式编辑web服务的端点,.net,web-services,configuration,console-application,.net,Web Services,Configuration,Console Application,有没有一种方法可以通过编程更改web服务的值?在我的app.config文件中,我有以下代码: <system.serviceModel> <bindings> ... </bindings> <client> <endpoint address="http://dev.remotedomain.com/WebServices/WebService.asmx" binding="ba

有没有一种方法可以通过编程更改web服务的
值?在我的app.config文件中,我有以下代码:

<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>


用密码。在.NET中是否可以编程实现这一点?

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

作为新的XXXXX客户端的Dim服务
service.Endpoint.Address=newendpointaddress(myUrl)

有关更多信息,请参阅本文:

这是可行的,但会让我产生怀疑。添加WCF服务引用后,有六个项目文件引用该服务URL。然后,我将服务移动到另一个URL,添加这行代码,一切正常。似乎它不应该编译???@nuander编译很好,只是字符串不同。只要不同的URL符合相同的协议和格式,就不会出现运行时问题。
address="http://dev.remotedomain.com/WebServices/WebService.asmx"
address="http://mymachine/WebServices/WebService.asmx"