以编程方式编辑 Web 服务的端点
有没有办法以编程方式更改 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>
我希望能够更改
address="http://dev.remotedomain.com/WebServices/WebService.asmx"
为
address="http://mymachine/WebServices/WebService.asmx"
代码。这在 .NET 中可以通过编程实现吗?
Is there a way I can programmatically change the <endpoint address="..." />
value of a web service? In my app.config file, I have the following code:
<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>
I want to be able to change
address="http://dev.remotedomain.com/WebServices/WebService.asmx"
to
address="http://mymachine/WebServices/WebService.asmx"
in code. Is this possible progammatically in .NET?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用类似于以下内容的代码:
Dim service as new XXXXXClient
service.Endpoint.Address = 新EndpointAddress(myUrl)
You can use code similar to the following:
Dim service as new XXXXXClient
service.Endpoint.Address = New EndpointAddress(myUrl)