The HTTP request to http //xxx has exceeded the allotted timeout.
We have a WCF application with Silverlight 4.0 client application. The system worked well but just sometimes we got the following error:
The HTTP request to http://xxx has exceeded the allotted timeout. The time allotted to this operation may have been a portion of a longer timeout.
We traced the bug using Visual Studio 2010 and got the following popup message:
There are some solutions on internet. most of cases start from add the following content in WCF’s web.config file or app.config file (self-host WCF):
<basicHttpBinding>
<binding name="BasicHttpBinding_ConspecService"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00" >
</binding>
</basicHttpBinding>
But, it will NOT help. the error still come.
**The final solution is "Specifies the maximum number of connections to a network host" **
The following code example configures an application to use four connections to the server www.???.com and 80 connections to all other servers.
In config file (WCF side):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<connectionManagement>
<add address="*" maxconnection="80"/>
<add address = http://www.???.com maxconnection = "4" />
</connectionManagement>
</system.net>
</configuration>
Or code behind (WCF side):
//how many outgoing connection that can make to a single endpoint. Default Value is 2
System.Net.ServicePointManager.DefaultConnectionLimit = 80;