1

Calling Dispose() on a WCF channel will sometimes block for one minute until a TimeoutException is raised. This seems to be generally if the server has torn down the channel from its end already.

Since we're trying to dispose of the channel and given this usually happens when the channel has already been torn down from the other end, is it possible to reduce the time out period used for the Dispose() calls?

dlanod
  • 8,664
  • 8
  • 54
  • 96

1 Answers1

0

Calling Dispose() on a WCF channel will sometimes block for one minute until a TimeoutException is raised. This seems to be generally if the server has torn down the channel from its end already.

Not always. Depending on your binding & your channel management, you can not close/dispose a channel until the service has finished processing the operation.

There is a precious article here that explains why one-way calls are not always one-way aka why closing a channel can block. This can help you choose another binding configuration.

Since we're trying to dispose of the channel and given this usually happens when the channel has already been torn down from the other end, is it possible to reduce the time out period used for the Dispose() calls?

This can be managed by the client's timeout settings in the client config file. There are four settings (Open, Send, Receive & Close). This depends on your binding but it is generally like this (one minute here):

<binding openTimeout="00:01:00" 
             closeTimeout="00:01:00" 
             sendTimeout="00:01:00" 
             receiveTimeout="00:01:00">
</binding> 

Here is the deal : the WCF client side throws TimeoutExceptions after this duration when the request processing takes 1 min 30 on the service.

Calling Dispose or Close is pretty much the same and will try to close the channel. You have to be very aware of the Dispose/Close issue : Closing a channel can throw exceptions, causing the channel to remain open. Read on the way to avoid this here.

I'm also very curious why calling Dispose takes 60 sec in your context. This suggests something is not valid in your WCF implementation.

Community
  • 1
  • 1
Cybermaxs
  • 24,378
  • 8
  • 83
  • 112