我得到一個異常,表明JSON請求太大而無法反序列化。JsonValueProviderFactory拋出「請求太大」
它從JsonValueProviderFactory未來....
的MVC應用程序目前使用Json.Net其中有沒有問題反序列化JSON數據的自定義模型粘合劑。不過,我假設默認的JSON值提供商正在絆倒?或者內置了一些奇怪的限制?
這可能與MVC4的最新版本有關,因爲當使用MVC4的先前版本時,大量的JSON沒有問題。
那麼,有沒有辦法改變實際json值活頁夾的設置?
我得到它的一些定製的東西,把它變成一本字典的印象....我無法找到與之相關的或者有任何設置,我可以改變任何代碼?
或者我可以使用另一種ValueBinder?
或其他選項?
Server Error in '/' Application.
The JSON request was too large to be deserialized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The JSON request was too large to be deserialized.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The JSON request was too large to be deserialized.]
System.Web.Mvc.EntryLimitedDictionary.Add(String key, Object value) +464621
System.Web.Mvc.JsonValueProviderFactory.AddToBackingStore(EntryLimitedDictionary backingStore, String prefix, Object value) +413
System.Web.Mvc.JsonValueProviderFactory.AddToBackingStore(EntryLimitedDictionary backingStore, String prefix, Object value) +164
System.Web.Mvc.JsonValueProviderFactory.AddToBackingStore(EntryLimitedDictionary backingStore, String prefix, Object value) +164
System.Web.Mvc.JsonValueProviderFactory.AddToBackingStore(EntryLimitedDictionary backingStore, String prefix, Object value) +373
System.Web.Mvc.JsonValueProviderFactory.AddToBackingStore(EntryLimitedDictionary backingStore, String prefix, Object value) +164
System.Web.Mvc.JsonValueProviderFactory.GetValueProvider(ControllerContext controllerContext) +116
System.Web.Mvc.<>c__DisplayClassc.<GetValueProvider>b__7(ValueProviderFactory factory) +34
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +151
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +177
和可悲的是,你只能獲得聲譽的這一微小的量,如果有人誰的答案如何分割在C#中stirng將得到桶加載:)謝謝!真的很有用......有趣的是,只是讓maxJsonLength變大就行不通了。我有一種感覺,可能在默認的Json Value綁定中存在缺陷 – 2012-03-01 20:55:24
由於我的自定義模型綁定器正在處理所有事情,所以我只調用了remove。我不想成爲雙重反序列化的一切! – 2014-08-07 14:39:55
如果我發送一個'string'並用JSON.NET反序列化它會怎麼樣?如果字符串太大,我會得到一個錯誤嗎? – 2015-05-07 13:05:00