Proxyless WCF Client Side


/ Published in: C#
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.