Posted By

rengber on 02/02/12


Tagged


Versions (?)

Proxyless WCF Client Side


 / Published in: C#
 

From page 70 or so of Juval Lowry's Programming WCF

  1. //Two techniques
  2.  
  3. //1 - Create a ChannelFactory<T> which refers to an endpoint in client config.
  4.  
  5. ChannelFactory<IDoStuff> factory = new ChannelFactory<IDoStuff>("MyEndpoint");
  6. IDoStuff proxy = factory.CreateChannel();
  7.  
  8.  
  9. //2 - Create everything yourself in code
  10.  
  11. NetTcpBinding tcp = new NetTcpBinding();
  12. EndpointAddress addr = new EndpointAddress("net.tcp://localhost:8001/");
  13. IDoStuff proxy = ChannelFactory<IDoStuff>.CreateChannel(tcp, addr);

Report this snippet  

You need to login to post a comment.