如何在客户端站点中以编程方式更改端点地址? [英] How can I change the endpoint address programmatically in the client site?

查看:19
本文介绍了如何在客户端站点中以编程方式更改端点地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在客户端站点中以编程方式更改端点地址?

How can I change the endpoint address programmatically in the client site?

推荐答案

proxy.Endpoint.Address = new EndpointAddress("http://newaddress");

其中 proxy 是导入 WSDL 时生成的客户端类的实例.或者你可以在创建客户端代理时指定地址:

where proxy is an instance of the client class generated when importing the WSDL. Or you can specify the address when creating the client proxy:

var endpoint = new EndpointAddress("http://newaddress");
var proxy = new SomeClientProxy("BasicHttpBinding_IHelloWorld", endpoint);

这篇关于如何在客户端站点中以编程方式更改端点地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆