WCF代理和Windows应用程序

问题描述:

大家好,
我有一个.Net Windows应用程序.我已使用VS 2008的添加服务引用"选项为该应用程序添加了Wcf引用.
我在WCF中更新了一个方法(签名相同),并修改了托管地址.
现在,我已将我的窗口应用程序配置文件更改为指向正确的主机地址,但它仍旧使用旧的WCF.
当我开始进行挖掘时,我发现,当我最初使用VS 2008的添加服务引用"选项添加WCF引用时,它会创建许多文件(代理类),并且这些文件指向旧的WCF地址. br/> 我不想使用VS 2008的更新服务引用"选项来更新Windows应用程序中的服务引用,就像这样做一样,我不需要再次将可执行文件分发给所有用户.

任何帮助将不胜感激.

Hi All,
I have an .Net windows application. I have added an Wcf reference to this application using "Add Service Reference" option of VS 2008.
I have updated an method in the WCF(signature is same) and modified the hosting address.
Now, I have changed my window app config file to point to right host address but it is still hitting the old WCF.
When I start digging it out, I found that, when I added the WCF reference initially using "Add Service Reference" option of VS 2008, It creates lots of files(Proxy classes) and those files are pointing to the old WCF address.
I do not want to update the service reference in my windows application using "update Service Reference" option of VS 2008 as if I do so than I need to distribute the exeutable again to all the users.

Any help would be appreciated.

使用采用Endpoint参数的client/proxy类构造函数.您可以创建一个Endpoint对象,以指定正确的服务地址,该地址可以进行硬编码或从配置中获取.
Use the client/proxy class constructor that takes an Endpoint parameter. You can create an Endpoint object specifying the correct service address, which can be hard-coded or obtained from configuration.