1

We have an Web API hosted on Azure at the moment, when we get a large response back (250MB+) it does not send the response back but the status code is 200. On our local we get the JSON response back successfully, we believe there is a response limit set on Azure.

If possible how can we increase this limit?

1 Answers1

0
If possible how can we increase this limit?

You can try to add this code in your web.config file to increase the size of the response:

<configuration> 
       <system.web.extensions>
           <scripting>
               <webServices>
                   <jsonSerialization maxJsonLength="50000000"/>
               </webServices>
           </scripting>
       </system.web.extensions>
    </configuration> 

Response does not have any limit. We can limit the response size by adding a parameter called as Content-Length into the response header.

To increase request size you put the below code into web.config:

<system.web>
<httpRuntime maxRequestLength="2147483647" />
RKM
  • 1,234
  • 1
  • 4
  • 9
  • thanks, do you know how to set the in asp core .Net5? I did try adding AddNewtonsoftJson to my controllers but that also did not help. – Derick van der Sandt Apr 07 '22 at 10:20
  • refer this SO thread--https://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config/12278956#12278956 to set that. – RKM Apr 07 '22 at 10:47
  • This hasn't resolved my issue, I believe there is a limit set on Azure which one cannot change – Derick van der Sandt Apr 11 '22 at 08:15