WCF TCP clients - basic guidelines on how to use them?

后端 未结 2 1079
陌清茗
陌清茗 2021-02-06 02:12

I\'ve got a WCF service and want to connect to it using a TCP binding. This is all well and good, but how are you supposed to handle the clients? I\'ve noticed that if you creat

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 02:26

    Are you closing your service proxies on the client side?

    IService service = channelFactory.CreateChannel();
    
    service.DoStuff();
    
    ((IContextChannel) service).Close();
    

    This applies to all WCF clients, regardless of whether the binding is TCP or not.

    For more information, see: http://msdn.microsoft.com/en-us/library/aa355056.aspx

提交回复
热议问题