You might have some fun like me trying to figure out what’s going on when everything looks fine from server side, but an internal error occured before it reaches your client side, with a message like: Nancy.Json.JsonSettings.MaxJsonLength Exceeded
As you can suppose, you have to either reduce the size of your object, or (more likely) to increase the max json length that your server can transfer to your client.
The trick is that if you are just looking for MaxJsonLength Exceeded on Google, you will find lot’s of answers for ASP.NET which basically consist of a new line in your web.config.
But if you want to make it works with Nancy, you have to write (Of course you can replace Int32.MaxValue by a more decent value):
JsonSettings.MaxJsonLength = Int32.MaxValue
Put it anywhere in the initialisation of your server (I personally do it in my bootstrapper class). And do not write anything about json size in your web.config because Nancy just does’nt care.
2 thoughts on “MaxJsonLength property with Nancy”
How about 2.0? This setting does not exist
Sorry, I don’t use it anymore :/