2

I am currently trying to import data in my database through my webapp, which is hosted on azure (the data is stored in an xlsx file).

The problem I have is that azure gives me a server time out error after around 4 minutes everytime, even though the import process works like a charm when I am working offline.

The exact error message is the following: 500 the request timed out web server failed to respond azure.

If somebody ever encountered that message and has a clue how to solve it, I would appreciate any help.

Thanks!

Max Gt
  • 31
  • 1
  • 4
  • 2
    A screenshot of the error might help. Also, if possible, post a snippet of the code that you use to import. – CyprUS Nov 10 '16 at 00:37

2 Answers2

2

Make any long processing in a web job not inside the HTTP request.

When the user submit the request, get the excel file, upload it to an Azure Storage Account, store the path in the database and post a message in a queue. Make the web job listen for the queue and do the needed processing.

You can communicate the results back using SignalR, the web job can send a message to a SignalR hub and the web application can get this message and display it for the user.

Haitham Shaddad
  • 4,336
  • 2
  • 14
  • 19
0

We hit this problem, and our understanding is that the Azure infrastructure gives you four minutes to process a request before the firewall or network balancing cuts it off and returns the 500 error. We found that a long running request is not possible. However a request that takes a long time to transmit its data can run much longer than 4 minutes because the timer starts after the request is completely transmitted.
I know this does not solve your problem directly, our solution was to ensure all request processing completed in well under 4 minutes.

The following question Azure Http Timeout Workaround has some approaches that provide you with further information and ways to avoid the problem.

Community
  • 1
  • 1
miltonb
  • 6,905
  • 8
  • 45
  • 55