Anders Martini
Anders Martini

Reputation: 948

502 Bad Gateway error on Azure website

Im currently integrating a new Payment system (Trustly) into my website. This involves sending a jsonstring to Trustlys server. This code is working perfectly locally, but on my testing environment on azure i get a 502 bad gateway error. Whats wierd is the app seems to break inside a try block, yet the following catch block does not fire. Consider this code:

        var postData = PrepJsonForTrustly(someSecretData);

        try
        {
            _logger.Info("attempting Deposit to trustly");  //this shows up in my logs
            var res = _client.Deposit(postData);
            _logger.Info("TrustlyDeposit successful"); //this doesn't
            return res;
        }
        catch (Exception ex)
        {
            _logger.Info("Failed Deposit to Trustly"); //and, oddly, neither does this!
            throw ex;
        }

Googleing the issue I found this http://blog.wouldbetheologian.com/2014/07/502-bad-gateway-error-on-azure-websites.html

Which seems to describe most of the same symtoms, except my code works perfectly on localhost, the stackoverflowexception he describes would have crashed my local server too.

Any Ideas what may be causing this? Or why my catch-block isn't firing?

Upvotes: 4

Views: 6250

Answers (1)

Galin Iliev
Galin Iliev

Reputation: 167

A possible explanation of missing logs would be if the process crashes. Have you checked eventlog.xml file (in the logFiles folder) - this is the file that write the application event log.

Upvotes: 7

Related Questions