Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Windows Service TimeOut

I have a client application developed in .net seding a request to wcf service and supposed to send reponse .if execution time with in 1 minute,there is no error,if it exceeds 1 minute the error is

Inner exception: This request operation sent to net.tcp://localhost:18001/PitToPort/2008/01/30/StockpileService/tcp did not receive a reply within the configured timeout (00:01:00).
The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client

How to increase the time out and how? What is the best solution?

like image 715
rmdussa Avatar asked May 28 '09 05:05

rmdussa


People also ask

What is the default timeout for WCF service?

The default is 00:10:00. This setting is only used on the server-side and has no effect on client-side.

What is a WCF service?

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.


2 Answers

Be careful, this error message is a boilerplate string WCF sends when it doesn't have a clue what happened. It really means "mmh something went wrong in the chain but I'm not really sure what, so, here's some trivia about the configuration, do what you want with it".

MOST OF THE TIME when you get this message it has nothing to do with actual timeouts. It can be quotas (number of objects in the graph, overall size, array length) or something that went wrong server-side, between the time your service method returned a result and the actual bytes were sent over the wire. So, you should check your configuration settings (and not the timeout, except if you had to actually wait for one minute to get the error. If you got the error straight away, it has nothing to do with timeouts whatsoever).

This useless message is on top of my list of WCF annoyances.

like image 107
Yann Schwartz Avatar answered Sep 19 '22 16:09

Yann Schwartz


The timeout is called "sendTimeout" and you can configure it on your binding section in your config file, or in code - your choice.

config:

  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding sendTimeout="00:03:00" />
      </netTcpBinding>
    </bindings>

This will set the timeout to 3 minutes.

Marc

like image 21
marc_s Avatar answered Sep 21 '22 16:09

marc_s