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.
Comments
- Anonymous
July 23, 2013
Hi,I have created a WCf service and hosted that in windows service using nettcp binding. I need to create a scheduler to process very big files(300-500MB), the functionality is written in WCF service. I created a windows service as a scheduler. since the file is too big the processing is taking more than 15 minutes for a file.WCF is timing out before it actual finishes the processing. It times out exactly in 10 minutes. I have increased the timeout to 20 minutes at both server and client side, still it is failing.Please help - Anonymous
July 24, 2013
Hiyou can adjust all timeout-related setting longer, like 60 minutes. BTW, the exception details is very impormtant because we need to understand timeout about what? operatin timeout, or open time, or any other, and you can optimize the setting pointedly