WCF中的按需代理 [英] On demand proxies in WCF

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

问题描述

有人可以解释一下WCF中的按需创建代理是什么意思吗?

Hi, can anybody explain what does an creating on demand proxies in WCF means?

推荐答案

您好,您更具体吗?如果您只是想仅在需要时创建客户端代理的实例,则可以在调用服务之前立即创建它.并且,在服务调用完成之后,您将关闭代理.如果你是说你不 想要使用添加服务引用来创建代理,并想要动态调用服务,可能会很困难.至少,您需要了解服务期望的请求格式.然后,您可以动态创建一条消息,如中所述 http://blogs.msdn.com/b/kaevans/archive/2009/01/20/dynamically-invoking-web-services-with-wcf-this-time.aspx .如果您甚至不知道服务期望的消息格式,则必须手动调用svcutil来生成客户端代理类,然后使用 CodeDOM动态编译代码,最后使用反射来调用服务.

Hello, can you be more specific? If you mean you want to create an instance of a client proxy only when needed, then you can create it right before you want to call the service. And after the service call completes, you close the proxy. If you mean you don't want to use add service reference to create a proxy, and want to invoke a service dynamically, it can be difficult. At a minimum, you need to know the request format expected by the service. Then you can create a Message dynamically, as described in http://blogs.msdn.com/b/kaevans/archive/2009/01/20/dynamically-invoking-web-services-with-wcf-this-time.aspx. If you don't even know what message format the service expects, you will have to manually invoke svcutil to generate a client proxy class, use CodeDOM to dynamically compile the code, and finally use reflection to invoke the service.


这篇关于WCF中的按需代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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