I was trying to retrieve more than 1000 items from List and save back with some modification, then I faced this issue :Operation is not valid due to the current state of the object.
I first try with resource throttling configuration but found no any change in the error.
After surfing, I found this Forum
And after adding following parameter in AppSettings in Web.config
<add key="aspnet:MaxHttpCollectionKeys" value="20000" />
The issue has been resolved.
Now I want to know that what it does and why we use this for bigger data (While Retrieving and saving/updating back)
Then I found the following link and msdn article which tells us following:
aspnet:MaxHttpCollectionKeys:-
Limits the maximum number of items that can be present in any of the client-provided dictionaries of the HttpRequest object.
Default Value is 1000 and
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="1000" />
</appSettings>
Now, you can change the value as I shown above.If you explore it a bit more then:
One of the things this update does is update the System.Web.dll.
In the new System.Web.dll they modified some of the internal
classes and put a limit on the number of form input elements that
can be submitted to a page. This was most likely done to thwart
against the hash DOS attack. The default number of input html elements
that can be submitted is now 1000.
Updated :- 01/30/2014
When trying to run the timerjob using console application it is throwing same error, though I have already set the above setting in appsettings also used the RunWithElevatedPrivilaedges.
After surfing net, I found the solution that during console application we need to set
HttpContext.Current = null;
I first try with resource throttling configuration but found no any change in the error.
After surfing, I found this Forum
And after adding following parameter in AppSettings in Web.config
<add key="aspnet:MaxHttpCollectionKeys" value="20000" />
The issue has been resolved.
Now I want to know that what it does and why we use this for bigger data (While Retrieving and saving/updating back)
Then I found the following link and msdn article which tells us following:
aspnet:MaxHttpCollectionKeys:-
Limits the maximum number of items that can be present in any of the client-provided dictionaries of the HttpRequest object.
Default Value is 1000 and
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="1000" />
</appSettings>
Now, you can change the value as I shown above.If you explore it a bit more then:
One of the things this update does is update the System.Web.dll.
In the new System.Web.dll they modified some of the internal
classes and put a limit on the number of form input elements that
can be submitted to a page. This was most likely done to thwart
against the hash DOS attack. The default number of input html elements
that can be submitted is now 1000.
Updated :- 01/30/2014
When trying to run the timerjob using console application it is throwing same error, though I have already set the above setting in appsettings also used the RunWithElevatedPrivilaedges.
After surfing net, I found the solution that during console application we need to set
HttpContext.Current = null;
No comments :
Post a Comment