Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit a request execution time of WCF service?

Is there something in WCF configuration that defines a timeout for executing a request at service side? E.g. WCF service will stop executing request after some time period. I have a service which make some work depending on client input. In some cases a such call may take too much time. I want to limit the execution time of such requests on service side, not client one using SendTimeout. I know about OperationTimeout property, but it doesn't abort the service request, it just tells a client that the request is timed out.

like image 553
Kamarey Avatar asked May 31 '10 13:05

Kamarey


People also ask

What is the default timeout for WCF service?

The most common default timeout values within Archiver are: 2 min for querying the Microsoft SQL Server. 5 min for WCF connections (This is used heavily for internal communication between GFI Archiver's own modules).

What is ReceiveTimeout in WCF service?

ReceiveTimeout – used by the Service Framework Layer to initialize the session-idle timeout which controls how long a session can be idle before timing out.


1 Answers

In general terms, there's nothing that will totally enforce this. Unfortunately, it's one of those things that the runtime can't really enforce nicely without possibly leaving state messed up (pretty much the only alternative for it would be to abort the running thread, and that has a bunch of undesirable consequences).

So, basically, if this is something you want to actively enforce, it's a lot better to design your service to deal with this so that your operation execution has safe interruption points where the operation can be terminated if the maximum execution time has been exceeded.

Though it's a lot more work, you'll likely be more satisfied with it in the long run.

like image 159
tomasr Avatar answered Oct 18 '22 16:10

tomasr