有没有办法以编程方式更改 <endpoint address="..." />
Web 服务的值(value)?在我的 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>
我希望能够改变
address="http://dev.remotedomain.com/WebServices/WebService.asmx"
到
address="http://mymachine/WebServices/WebService.asmx"
在代码中。这在 .NET 中可以编程吗?
最佳答案
您可以使用类似于以下内容的代码:
Dim 服务作为新的 XXXXXXClient
service.Endpoint.Address = 新的 EndpointAddress(myUrl)
关于.net - 以编程方式编辑 Web 服务的端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3522375/