I had the same problem with an api returning more than 200mb.
After trying many things, I've fixed changing the app service from 32 bits to 64 bits.