我收到一个异常,即 JSON 请求太大而无法反序列化。
它来自 JsonValueProviderFactory......
MVC 应用程序当前有一个使用 Json.Net 的自定义模型绑定器,它在反序列化 json 数据时没有问题。但是我假设默认的 JSON 值提供程序出现问题?或者有一些奇怪的限制内置其中?
这可能与最新版本的 MVC4 有关,因为使用以前版本的 MVC4 时,大量 JSON 没有问题。
那么,有没有办法改变实际json值绑定器的设置呢?
通过去http://haacked.com/archive/2011/06/30/whatrsquos-the-difference- Between-a-value-provider-and-model-binder.aspx http://haacked.com/archive/2011/06/30/whatrsquos-the-difference-between-a-value-provider-and-model-binder.aspx
我的印象是,这是一些自定义的东西,将它变成了字典......我找不到任何与之相关的源代码,或者是否有任何我可以更改的设置?
或者我可以使用替代的 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