参考:http://blog.csdn.net/hsicool/article/details/7471810
在使用Repeat对签核单据做批量处理时,系统报出如下图所示的异常:
微软如何处理这个问题呢?
微软在2011年12月29日发布一个更新补丁,该补丁可限制每个 HTTP POST 请求最多包含 1000 个表单域。一旦你更新了这个补丁,那么你的表单不能过超过1000个表单字段,如果超过将会抛出如下异常:
System.Web.HttpException:
The URL-encoded form data is not valid. ---> System.InvalidOperationException: Operation is not valid due to the
current state of the object.
at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
at System.Web.HttpRequest.FillInFormCollection()
--- End of inner exception stack trace ---
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()
关键内容是 ThrowIfMaxHttpCollectionKeysExceeded. 如果你发现有这个字符串表示表单域超出了限制,你可通过修改 web.config 来修改这个限制值:
1 | < appSettings > |
2 | < add key = "aspnet:MaxHttpCollectionKeys" value = "5000" /> |
3 | </ appSettings > |