最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - "The JSON request was too large to be deserialized" MVC KnockoutJs - Stack Overflow

programmeradmin5浏览0评论

I've been scrapping the threads for an answer in similar threads with no luck.

I am using knockoutJS to pass the information back from my partial view and I am getting the "The JSON request was too large to be deserialized".

I have done the " " fix but this isn't helping.

My page has quiet a bit of information to pass back in the forms of lists, and I believe this is why I am getting the errors on this page and not others where I am using knockout.

I have read that I can build my own serializer but that in itself can lead to more problems.

Would anyone be able to suggest alternatives?

One thing I was trying to find out is if I can stop passing back the whole lists and only pass back the selected values, but I can't seem to find any more information on this .

TIA

I've been scrapping the threads for an answer in similar threads with no luck.

I am using knockoutJS to pass the information back from my partial view and I am getting the "The JSON request was too large to be deserialized".

I have done the " " fix but this isn't helping.

My page has quiet a bit of information to pass back in the forms of lists, and I believe this is why I am getting the errors on this page and not others where I am using knockout.

I have read that I can build my own serializer but that in itself can lead to more problems.

Would anyone be able to suggest alternatives?

One thing I was trying to find out is if I can stop passing back the whole lists and only pass back the selected values, but I can't seem to find any more information on this .

TIA

Share Improve this question asked Apr 21, 2017 at 9:34 Ross SummerellRoss Summerell 511 silver badge7 bronze badges 1
  • Hi Ross, wele to SO. Please can you post the code so that the problem can be reproduced? – Luke Commented Apr 21, 2017 at 9:55
Add a ment  | 

3 Answers 3

Reset to default 6

I added the key below and it worked for me.

<appSettings>
    <add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
</appSettings>

This may be by design.... to protect the site from DoS attacks or time-out conditions

There is an app setting for MaxJsonDeserializerMembers which you may be able to increase, but would need to be done with care: ...JSON payload members fails with an exception

What I have done in the past is to either break up the forms into (collapsible) sections and doing AJAX posts by group, or spreading the form out over multiple pages. Front end users generally will be happier if anything as they don't see the gazillion fields at once.

I've had the same error message when I returned partial view via ajax call. It turned out that the problem was in the partial - "Object Reference not set to an instance of an object".

@User.Address.Address1

The "Address" was null. Fixed that by doing some checks

@if(User.Address != null){
   @User.Address.Address1
}
发布评论

评论列表(0)

  1. 暂无评论