tags:

views:

50

answers:

1

Hello,

I am using a ChannelFactory with netTcpBinding. Sometimes I get exceptions and after these I can not use the channel anymore because it is in faulted state.

What should I do to reestablish the connection? Should I call abort(), then close/open. Or Close(), then open(), or should I just use a new object like:

myPublicChannel = this.ChannelFactory.CreateChannel();

Should I reopen the connection just in my catch block? Will I need a special locking mechanism because other threads could also use this channel and then try to reestablish the connection simultaneously.

Thank you very much for your answer in advance!

Thank you for your answer. Here is a link I found that could be helpfull for others with the same problem/question:

http://blogs.msdn.com/b/drnick/archive/2007/11/05/custom-transport-retry-logic.aspx

+1  A: 

I would actually close and set it to null to dispose anything from the connection then use open, I have written some web services before where not disposing the ChannelFactory caused some memory leaks and other problems.

Jesus Ramos