This user has exceeded an allotted request.form.count count.

silverlight - The HTTP request to *.svc has exceeded the allotted timeout. The time allotted to this operation may have been a portion of a longer timeout. - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
I have been developing a Silverlight application using WCF.
The problem is that sometimes it throws an exception stating:
"The HTTP request to 'http://localhost:1276/Foo.svc' has exceeded the allotted timeout. The time allotted to this operation may have been a portion of a longer timeout."
So how do I increase the timespan? Some have suggested the usage of receive time out as below in web config and in service.client config file
&bindings&
&customBinding &
name="customBinding0" receiveTimeout="02:00:00" &
&binaryMessageEncoding maxReadPoolSize="" maxWritePoolSize="" maxSessionSize="" /&
&httpTransport maxBufferPoolSize="" maxReceivedMessageSize="" maxBufferSize="" transferMode="Buffered"/&
&/binding&
&/customBinding&
&/bindings&
what would be the maximum value for the receiveTimeout property?
3,07243560
1,471103060
I imagine the issue is not that your ReceiveTimeout is beyond the maximum value for that setting, as the MaxValue of a TimeSpan is over 10 million days. Instead, I think the settings are just not taking effect.
You should try increasing the timeout values on both the server and the client-side per :
On the server (in your web.config)
&binding name="customBinding0" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00"&
On the client (in your ServiceReferences.ClientConfig)
&binding name="CustomBinding_DesignOnDemandService" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00"&
3,07243560
Did you find this question interesting? Try our newsletter
Sign up for our newsletter and get our top new questions delivered to your inbox ().
Subscribed!
Success! Please click the link in the confirmation email to activate your subscription.
The HTTP request to
has exceeded the allotted timeout. The time allotted to this operation may have been a portion of a longer timeout.
Three places to set time values to fix this issue…
Web.Config
&httpRuntime executionTimeout="600" /&
(this is seconds, so here it’s 10min).
More info on httpRuntime here.
On your Web.Config Binding Elements
&binding name="customBinding123"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00" /&
On your ServerReferences.ClientConfig binding elements within the system.serviceModel
&binding name="CustomBinding"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00" /&
16.7k114658
Some days ago we got the same error message. I found this thread, but before we started to increase the different timeout properties, we checked the antivirus software of the client machine: it was NOD. The newer NOD (and maybe other AVs) has port filter/block possibility. We turned off the 80/443 port blocking, and the client connected without any timeout error message.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
The week's top questions and answers
Important community announcements
Questions that need answers
By subscribing, you agree to the
Stack Overflow works best with JavaScript enabledbatch - Workaround for the 10 web service callout limit in apex? - Salesforce Stack Exchange
to customize your list.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.
Here's how it works:
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
What are the workarounds for the 10 web service callout limit in apex. If you need to make, say 50 callouts, how do you batch them so that you can execute them all asynchronously? Is there a good design pattern for it?
I'm frequently in this situation and there are different solutions for it that I'm aware of, but I thought it would be good to get this documented on the stackexchange, because it can be tricky and the documentation elsewhere is not great.
Note: The limit was raised to 100 callouts in the Winter '15 release, so this question is somewhat outdated now:
(community wiki)
@future (valid for triggers and visualforce)
From trigger or VF context you can have up to 10 calls to @future & each of them has a separate context that allows 10 callouts. So you can get up to 100 callouts from a trigger (that itself you're guaranteed will not contain more than 200 records if it's saved with API > 20.0, capped at 100 otherwise) or 10+100 in VF. Not bad. Before you decide to abuse it - consider the fact that there's a
and that multiple callouts to same endpoint might also throw an error. From :
A callout request is limited to a maximum of 20 simultaneous requests
to URLs with the same host. The host is defined by the unique
subdomain for the URL, for example,
are two different hosts. This limit is calculated
across all organizations that access the same host. If this limit is
exceeded, a CalloutException will be thrown.
Batch Jobs
let you process many records (up to 50 M) with whatever granularity you wish (if you don't specify it, granularity will be 200). Essentially you decide which records you want to work on, you get a fresh context & governor limits for each chunk of data you're processing and then at the end of the batch job you can send an email, kick-off another batch etc. They're great for background processing tasks.
In batch jobs you can specify an optional
parameter. If you really need this, the batch job may even be instructed to process 1 record at a time (and again - each execute() will let you make 10 callouts). That is - if you'll make sure that the batch class implements Database.AllowsCallouts ;) Read more about
if you want to take this path.
Essentially:
public class MyBatchableClass implements Database.Batchable&sObject&, Database.AllowsCallouts{
// definitions of start(), execute() and finish() as in any batch
// and then in code that fires it (scheduled class? something that happens
// after user clicks a button? you use
Database.executeBatch(new MyBatchableClass(), 1);
// instead of
// Database.executeBatch(new MyBatchableClass());
Javascript-related solutions
You can jump back and forth in the context. Build a Visualforce page that would process N records at a time, return to the browser, issue a next call that processes another N...
You know your data best - N can be a fixed number or maybe you'll just want to compare output of :
if(Limits.getCallouts() == Limits.getLimitCallouts()){
return 'I\'m not done yet';
This is best suited in environment where user expects some kind of progress report like "X out of Y records processed". If you're after a fully automated background solution that can't be interrupted by user closing the tab for example - go for one of previous two.
"The call" can be Javascript that hits Apex code in form of webservice call (in ajax toolkit - for example a button on list view that processes selected records), @RemoteAction , actionFunction etc.
The existing answers are all pretty good. I've had to work with all of these situations before. Ultimately if you need more than even those workarounds will allow you'll have to look at redoing the web service so you don't have to make as many callouts. Options for that? How about:
If you have control over the webservice you could alter it to be able to take a batch set of data and process them all individually on the server.
If you don't have control over the webservice you could look at writing an intermediary service that took the batch of data, and then individually called the real webservice individually.
That last one in particular would be a last resort sort of attempt as it's really messy but sometimes that's what it takes to get SFDC to work the way you need it to.
2,65252956
Setup an APEX Batch Job:
Than use an object iterator to keep track of how many total callouts you have to make through a simple association.
If you have 50 callouts to make, than you might need 5 records, each of which can represent a total of 10 possible callouts.
Hopefully whatever service you need to call out to get results from allows you to index results so you don't always have to start at the begging.
There will be some delay because Apex Batch jobs run when system resources are available, and there can be a delay.
Another way might be to use a page reference that points back to the same page, and increments an iterator until no more results are needed:
public PageReference continue(){
PageReference pageRef = ApexPages.currentPage();
sObject result = [SELECT IndexId__c FROM sObject WHERE Id ...];
if(result & 1000){
methodThatMakesCalloutsAndIncrementIndex();
pageRef.setRedirect(true);
pageRef = Page.FinishedP
Current limits have been increased to 100 if anyone needs it. Check out total number of callouts allowed here -
The key is that the limit is "per execution", and an AJAX call (done
through a standard Visualforce ) is actually a
single execution. I can "loop" in Javascript to do requests as long as
I need it.
Let's have a look at the code.
The controller:
public with sharing class testJavascript {
public String requestStatus { }
public String requestMore { }
public Integer requestNumber { }
public Integer requestCurrent { }
public testJavascript () {
requestStatus = '';
requestMore = '';
requestNumber = 10000;
requestCurrent = 0;
public void doRequest () {
if (requestCurrent &= requestNumber) {
Http http = new Http();
for (Integer startPoint = requestC (requestCurrent &= requestNumber) && ((requestCurrent - startPoint) & 10); requestCurrent++) {
HttpRequest req = new HttpRequest();
req.setEndpoint('');
req.setMethod('GET');
HTTPResponse res = http.send(req);
requestStatus = requestCurrent + ' out of ' + requestNumber + ' processed';
if (requestCurrent &= requestNumber)
requestMore = 'false';
else requestMore = 'true';
&apex:page controller="testJavascript"&
&apex:form&
&apex:outputpanel id="status"&
{!requestStatus}
&script&requestContinue = {!requestMore};&/script&
&/apex:outputpanel&
function requestMore() {
if (requestContinue)
doRequest();
&button onclick="if (doRequest())"&Start&/button&
&apex:actionfunction action="{!doRequest}" name="doRequest" oncomplete="requestMore()" rerender="status"&
&/apex:actionfunction&
&/apex:form&
&/apex:page&
Some explication:
In the controller I have a request counter (requestCurrent, set to 0
at beginning) and a request amount (requestNumber, set to 10000 at
beginning) and a method, doRequest(), that, given those two variables,
executes the next 10 HTTP requests (increasing the counter) and
updates the status String (requestStatus) and the requestMore
String/Boolean, setting it to true if other requests are needed (if
the counter is lower than the request amount we need) or false if not.
In the page I have an apex:actionFunction pointing to this method,
that rerenders the status panel. In the panel I show the status string
and I update a Javascript global variable (requestContinue) with the
String/Boolean given in requestMore by the doRequest() APEX method.
The actionFunction has an oncomplete attribute that calls another
Javascript function, requestMore(), that is in the page code. This
function checks for requestContinue value (updated after each
rerender): if true calls again the doRequest() actionFunction and 10
more requests are executed, if false it does nothing. The user has
just to push the button that does the first actionFunction call to
start the loop.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Salesforce is a registered trademark , Inc.
Salesforce Stack Exchange works best with JavaScript enabled

我要回帖

更多关于 request获取useragent 的文章

 

随机推荐