我有一个发布相当大数据的表单,我收到此错误
[InvalidOperationException: Operation is not valid due to the current state of the object.]
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2419334
System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +58
System.Web.HttpRequest.FillInFormCollection() +159
[HttpException (0x80004005): The URL-encoded form data is not valid.]
System.Web.HttpRequest.FillInFormCollection() +217
System.Web.HttpRequest.get_Form() +104
System.Web.HttpRequest.get_HasForm() +9035903
System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97
System.Web.UI.Page.DeterminePostBackMode() +69
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +135
要解决此问题,我自己this solution from StackOverflow
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2000" />
</appSettings>
现在我想知道可以为aspnet:MaxHttpCollectionKeys
设置的最大有效值。将此键设置为最大值是否有任何问题?
答案 0 :(得分:7)
您可以在GitHub上的aspnetwebstack source中看到MaxHttpCollectionKeys的实现。
从实施情况来看,这似乎是限制:
此MSDN page建议不要将MaxHttpCollectionKeys设置为太大,因为这会造成安全风险。