2012-10-25 27 views
2

使用我使用嚮導添加的web服務(Visual Studio 2012)(右鍵單擊添加web服務引用)我添加了以下url 「http://onwww.org:8086/Plugins/Misc .onwww/Remote/NopService.svc「更改web服務地址在執行中

我有另一個使用相同api的webservice,webservices在各方面都是一樣的,同樣的契約也是一樣的。

「http://yadisrael.org:8086/Plugins/Misc.onwww/Remote/NopService.svc」

我想執行到另一個域時在代碼中更改域名,又怎麼會有我改變價值?

感謝

回答

1

你可以指定你的配置文件中的兩個不同的端點配置,然後當你實例化服務客戶爲每個不同的端點,調用了the overload that accepts an endpointConfigurationName構造。或者,您可以指定一個端點配置,然後調用其中一個the overloads that takes a remoteAddress or endpointAddress and the endpoint configuration name.

+0

問題是我需要添加到此列表中的一個常量基礎上,我製作了一個nopcommerce插件,將集中使用 – user1625293