Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between OperationTimeout and SendTimeout in WCF

Tags:

c#

wcf

After quite a bit of searching, I could not find the answer to this question.

What is exact difference between OperationTimeout and SendTimeout? I read OperationTimeout is a subset of SendTimeout and SendTimeout includes writing message in the channel. If you give more details that would be great.

My second question is I have client call to a service where I just want to set timeout between soon after request sent to the server and soon after received reply from the server. How to set this timeout?

like image 468
Amzath Avatar asked Mar 14 '11 19:03

Amzath


People also ask

What is SendTimeout WCF?

SendTimeout – used to initialize the OperationTimeout, which governs the whole process of sending a message, including receiving a reply message for a request/reply service operation. This timeout also applies when sending reply messages from a callback contract method.

What is OperationTimeout?

SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including receiving a reply message in a request-reply case). This timeout also applies when sending reply messages from a CallbackContract method.


2 Answers

I'd like to propose reading this answer from Brian McNamara over on the MSFT forums:

Brief summary of binding timeout knobs...

Client side:

  • SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including receiving a reply message in a request-reply case). This timeout also applies when sending reply messages from a CallbackContract method.
  • OpenTimeout and CloseTimeout are used when opening and closing channels (when no explicit timeout value is passed).
  • ReceiveTimeout is not used.

Server side:

  • Send, Open, and Close Timeout same as on client (for Callbacks).
  • ReceiveTimeout is used by ServiceFramework layer to initialize the session-idle timeout.
like image 196
Vincent Vancalbergh Avatar answered Sep 18 '22 06:09

Vincent Vancalbergh


I know it is an old question and WCF has reached its end of life - nevertheless I stumbled upon this exact problem.

The answer which Vincent quoted from Brian McNamara is correct (SendTimeout is used to initialize the OperationTimeout). It is just not complete.

The SendTimeout also covers the time which is used for sending (the write operation itself) the data! See the Microsoft Docs

This really makes a difference if you increase the OperationTimeout for certain heavy services. But do not increase the SendTimeout on the binding (for all services!) and a whole lot of data has to be transmitted via a poor line. That was the problem I ran into...

like image 20
toATwork Avatar answered Sep 17 '22 06:09

toATwork