Operation is not valid due to the current state of the object.

來源:互聯網
上載者:User

標籤:blog   http   strong   資料   2014   html   

昨天客戶突然要求將某個角色的所有許可權都不分頁的放在一個頁面修改,本地測試OK,通過;但發布後,點擊該頁面提交後一直報下面的錯誤:

異常資訊: Operation is not valid due to the current state of the object.
錯誤源:System.Web
堆棧資訊:   at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
   at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
   at System.Web.HttpRequest.FillInFormCollection()

 

分析異常資訊:System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded():很有可能是在頁面提交時,某個資料過大導致。

在網上找下發現這樣的情況,出現這個異常的原因正是因為上年12月29號那次微軟發布的最後一次非正常更新程式引起的.在這次安全更新中對於asp.net單次的提交量做了一個最大量限制1000,出現這個異常正是因為頁面提交量超過了1000這個限制.這個可以在web.config中增加參數來更改

解決方案:
<appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="2000" />
</appSettings>
value值根據需要可適當的修改

***********************************************************************************************
*【Author】:Mike.Jiang
*【Date】:2014年06月30日
*【URL】:http://www.cnblogs.com/dataadapter/archive/2012/06/29/2569795.html
*【Notice】:
*2、請尊重原創的成果,轉載和引用請註明作者及出處。
*3、本文必須全文轉載和引用,任何組織和個人未授權不能修改任何內容,並且未授權不可用於商業。
*4、本聲明為文章一部分,轉載和引用必須包括在原文中。
***********************************************************************************************
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.