Your WCF service may stop processing any incoming WCF requests

Background:

1. Suppose we have a WCF service which is using session-full binding like Net.tcp. We are using the default setting of timeout of net.tcp bindng . For example:

a) OpenTimeout -> 1 minute
b) CloseTimeout -> 1 minute

c) SendTimeOut-> 1 minute
d) ReceiveTimeout -> 10 minute.

More details about net.tcp binding timeout setting, you can refer to below article:
netTcpBinding

https://msdn.microsoft.com/en-us/library/ms731343(v=vs.85).aspx

Making Sense of Transport Quotas

https://blogs.msdn.com/b/drnick/archive/2006/03/10/547568.aspx

 

 

2. If the WCF request is quite time-consuming which takes more than 10 minutes, which is longer than receiveTimeout.

 

 

3. At the same time, before the previous WCF requests are processed completely, the subsequent WCF requests keep coming again and again.

 

In the end, you may find that the WCF service will stop processing any incoming WCF request any more.

 

 

4. Actually you can reproduce this issue easily with below specific condition:

 

  a) Use net.tcp binding.
b) To make this issue reproduced quickly, you can configure the timeout & service throttling less, for example:

1) OpenTimeout -> 10 seconds
2) CloseTimeout -> 10 seconds
3) SendTimeOut-> 10 seconds
4) ReceiveTimeout -> 60 seconds.
5) maxconcurrentcalls & maxconcurrentsessions & maxconcurrentinstance of service throttling -> 1 

  c) Design a WCF method like sleep(120 seconds) to simulate time-consuming WCF request.
d) Design a WCF client which will keep consuming this WCF service in 10 seconds interval. 

Root Cause:

Service throttling is not released properly while receiveTimeout due to WCF framework fault, which makes the service throttling reaches its limit finally. Since the service throttling has reached its’ limit, any incoming WCF request will be refused.

Workaround:

1. You can increase receiveTimeout value to make sure that the WCF request can be processed completely within the period of receiveTimeout.

2. Or you can use HTTP-based binding like basic-http binding instead of Net.Tcp binding.

 

Regards

Winston He from APGC DSI Team.