“The JSON request was too large to be deserialized” MVC KnockoutJs

扶醉桌前 提交于 2021-02-10 06:36:32

问题


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


回答1:


I added the key below and it worked for me.

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



回答2:


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.



来源:https://stackoverflow.com/questions/43539106/the-json-request-was-too-large-to-be-deserialized-mvc-knockoutjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!