动态添加WCF服务的参考 [英] Dynamically add reference of WCF service

查看:189
本文介绍了动态添加WCF服务的参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个WCF服务和客户端应用程序。我想用在客户端应用程序的服务。

I am creating a WCF service and Client application. I want to use the service in the client application.

其中,WCF服务将被托管尚不最终确定的位置。我要动态添加托管WCF服务的参考,而不构建客户端应用程序。我怎样才能achive呢?

The location where the WCF service will be hosted is not yet finalized. I want to dynamically add the reference of the hosted WCF service without building the client application. How can I achive this?

谢谢,

拉姆

推荐答案

做到这一点:


  • 创建客户端,你会在任何正常情况下

  • 更改服务的URL在配置时服务移动围绕

我觉得这是迄今为止最容易的解决方案。

I think this would be by far the easiest solution.

如果你坚持一个动态代理 - 有一个WCF动态代理这里的样本:

If you insist on a dynamic proxy - there's a sample of a WCF dynamic proxy here:

<一个HREF =http://code.msdn.microsoft.com/netfxsamples/Wiki/Print.aspx?title=WCF%20samples&version=8&action=Print> http://code.msdn.microsoft.com/ ?netfxsamples /维基/ Print.aspx标题= WCF%20samples&安培;版本= 8安培;行动=打印

向下滚动了一下,找到样本。这是C#代码向您展示如何将所有在代码中动态创建一个WCF代理。

Scroll down a bit to find the sample. It was C# code to show you how to dynamically create a WCF proxy all in code.

这篇关于动态添加WCF服务的参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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