Azure Network Load Balancer Time-out Errors

Another Azure enigma...

I've been working on a web application where we process mail merges and return .docx files via OpenXML. The system works great locally and remotely on Azure, if the mail merge batch is relatively small.

Here's where the problem becomes obvious; some of the batches have the potential to parse through thousands of records and returning documents with thousands of pages, this causes the document return to take several minutes.

Azure, however, employs an NLB to make sure that there aren't any idle connections that are wasting resources. Makes sense, right, otherwise how are they going to keep the pipes clear for the traffic to your site.

There is a fairly simple solution to getting around this, though some may see it as a bit of a hack. We created a custom status object, to return to an $.ajax() call. This object returns the status of the mail merge and if any errors have been encountered.

After our call to the method for the document was updated we added an <iFrame> element to the site and via jQuery update the .attr("src","{server.url.for.doc}). This allows the ability to simulate the post and download the file.

Known Issues:

  • Requires GET - and removes POST for document, making the call less secure (IMO)