问题
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