Amzath
Amzath

Reputation: 3249

Difference between OperationTimeout and SendTimeout in 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?

Upvotes: 17

Views: 18632

Answers (2)

toATwork
toATwork

Reputation: 1367

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...

Upvotes: 2

Vincent Vancalbergh
Vincent Vancalbergh

Reputation: 3337

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.

Upvotes: 31

Related Questions