简体   繁体   中英

Getting 504 on AJAX call [MVC]

I am encountering a 504 gateway_timeout on a certain page of my site when it is hosted in our production site's IIS. It works fine on my localhost, on our test site, and on our production server's localhost (accessed via localhost/link/abc)

I have ran out of ideas why this was occcurring, here is my code below:

function GetTableData(date, period, offset, method) {
    $(".load-bar").show();
    updateTimeStampTabular(date, period, offset, "Try");
    var link;

        if (method != "aa"  && method !=     "bb" && method != "cc") 
        {
        link = "../Tabular/";
         }
        else {
        link = "../Statistics/";
        }

        $.ajax({
        url: link + method,
        type: "GET",
        timeout: 200000,
        data: {
            date: date,
            period: period,
            timezoneOffset: offset
        },
        success: function (data) {
            $(".statistics .table-responsive").html(data);
            var overallStatusText = $(".right-sidebar span.status");
        },
        error: function(xhr, textStatus, errorThrown) {
        alert(xhr.status);
        alert(textStatus);
        alert(xhr.statusText);
        if (globalVars.unloaded)
            return;
        }
        });
        }

I can confirm that a function with "dd" exists in my TabularController and it uses [HttpGet] annotation. Any thoughts why this is happening when accessing the prod url? Other methods are called through the same way and they work fine, except for this instance on Tabular/Getdd

Apparently this had something to do with the timeouts set with AWS. To fix this issue, we adjusted the timeout settings and increased the limit of the waiting time of requests. My query (joining 2 very large and busy tables) sometimes yield results after 3 mins, so we just increased the limit to higher than 3mins.

I noticed that this is the cause because there are no issues with long waiting time if I view it with the test website and the issue only happens with the live website which uses a site certificate.

If I could go back to this issue however, I think i'd redo the query and make it work faster (if possible)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM