I have a WCF Service using netTcpBinding. the problem is that the host of this service not always active , so when a client tries to use the service it will succeed as long as the server is on-line. when the server re-starts the client must re-establist the channel (cause its netTcpBinding) using httpBinding will solve the problem but i cant use this bindi开发者_运维问答ng. my question is : Is there any way to cause netTcpbinding "act" like basicHttpBinding when connecting to the service (behavior ???) (every use at the service proxy cause new connection establishment) ??
Thanks, Liran
No if you use same proxy. Proxy by architecture can create channel only once. In Net.Tcp the channel is bound to connection. So if you want to open new connection for each call simply create new proxy each time you call the service. This will affect your performance because establishing net.tcp connection is expensive.
The better way is to redesign your code and wrap your proxy access. Wrapper will handle the exception during operation call by creating new proxy and calling the method on the new proxy.
精彩评论