0

I know this has been asked before, but I tried all known solutions and still no luck. I have a request that returns roughly 26MB of JSON. It is returning a 502 on my azure web app. I have set maxRequestLength and maxAllowedContentLength to their max allowed values as detailed here.

How to set the maxAllowedContentLength to 500MB while running on IIS7?

I have also set the applicationHost.xdt on the site folder of my webapp and verified it is applied as detailed here.

ApplicationHost.xdt in Azure Web Apps

None the less, my request timeout at exactly 4 minutes every time. I can run the same request against my localhost running on iisexpress pointed to the Azure SQL database and it returns the data, so I know this is something azure webapp speciic.

I have enabled all types of logging in "App Service Logs" section of my webapp. I see other failed request traces for 401 when session expires, but this request doesn't log a failed request trace, or an application error. In live log stream it shows the request as a 200 response in the web server logs.

Any other ideas?

Josh
  • 1,648
  • 8
  • 27
  • 58

1 Answers1

1

Thanks for a detailed question and sharing the solutions that you have already tried. I'm unsure if "Always ON" feature is turned on on your WebApp. Such time-out error may occur due this,so kindly enable it and let us know for further investigation.

Additional information, Azure Load Balancer has a default idle timeout setting of approximately four minutes (230 sec); this is a general idle request timeout that will cause clients to get disconnected after 230 seconds. However, the command will still continue running server-side after that. For a typical scenario, this is generally a reasonable response time limit for a web request. In such scenarios, you could look at async methods to run additional reports. WebJobs or Azure Functions is another option.

If ‘Always On’ config is not turned On, please do turn it on. The AlwaysOn would help keep the app loaded even when there's no traffic, it will send a request to the ROOT of your application. Whatever file is delivered when a request is made to / is the one which will be warmed up and this feature comes with the App Service Plan is not charged separately

1) From the Azure Portal, go to your WebApp.

2) Select Settings> Configuration > General settings.

3) For Always On, select On.

AjayKumar
  • 2,812
  • 1
  • 9
  • 28
  • I do have the "Always On" feature turned on. My app isn't behind an explicit load balancer (as in no LB present in resource list in Azure) but maybe there is an hidden one in front of every app service? Is there no way to increase the 230 second timeout? My api endpoints are async functions. I'd prefer not to move this endpoint to a webjob or azure function as its just a normal webapi endpoint used constantly in my app. Just in this case the tree it is pulling is abnormally large. – Josh Dec 20 '19 at 14:11
  • Another interesting piece of info, is that when i run this query locally it returns in 1 minutes. So I'm not sure if I'm hitting a time limit or a size limit. – Josh Dec 20 '19 at 14:18
  • I've been remote debugging my endpoints, and it seems the issue is actually that the EF query from my database never returns. On smaller trees it does, but on this one it just hangs indefinitely. So that explains why it works locally in 1 minutes but times out after 4 minutes on azure. Still no idea why the same code querying the same database with same connection string would work on local but not on azure. – Josh Dec 20 '19 at 14:54
  • Yes, it's the implicit Load balancer https://learn.microsoft.com/en-us/azure/app-service/faq-availability-performance-application-issues#why-does-my-request-time-out-after-230-seconds. To modify the value, add this to web.config - – AjayKumar Dec 26 '19 at 07:44