如何通过动态创建客户端代理来使用WCF服务

时间:2016-03-02 18:18:37

标签: c# wcf

我尝试使用提到的代码段here为服务生成代理,但我意识到该代码段仅适用于asmx服务。无论如何,对于c#中的WCF服务是否也这样做了?

1 个答案:

答案 0 :(得分:0)

Okay. After much searching found two classes which can do this for us along with help from others.

  1. codecompiler
  2. WSDLimporter

These two provide a way to download wsdl at runtime, extract contract and endpoint info and create code in C# or VB which can be compiled to create assembly on which reflection can be used to invoke WCF Service.

Hope this helps somebody someday!