Al: Web Client appears to timeout after 2 minutes

Created on 29 Mar 2018  路  9Comments  路  Source: microsoft/AL

This is for NAV 2018 RTM (19394), on premises

I have been having a problem that I thought related to the HttpClient type but appears to be a time out problem. I have increased all the timeouts in the service's customsettings.config file (attached) and the default timeout in the navsettings.json file (attached) is 20 minutes. However my process times out right about 2 minutes.
Files.zip

I have a process that calls a web service (REST) repeatedly to download data and it takes about 2.5 minutes to do so in C/AL and the AL code fails every time.

What is timing out?
What do I need to change to extend the timeout?

The code below duplicates the problem, just call it from any page.

    procedure TestTimeOut();
    var 
        startTime: DateTime;
        endTime: DateTime;
        Window: Dialog;

    begin
        Window.Open('Elapsed time: #1#############################');
        startTime := CurrentDateTime;

        while true do begin
            sleep(10000); //10 seconds
            endTime := CurrentDateTime;
            Window.Update(1, endTime - startTime);
        end;
    end;

bug ships-in-future-update

All 9 comments

Anybody have some feedback on this problem?

Hi @GreatScott000,
It seems to work for me. Contact support they can help you out.

@thpeder, I have duplicated this problem with D365BC March Update (NAV Build 12.0.21229, AL Build 0.15.18771) using the code below. The VM image is unchanged from its originally provisioned state.

I originally thought the HTTPClient was to blame but it is not the problem. I have stripped the code down to demonstrate the issue. This runs for approximately 2 minutes in the web client (I never see a duration greater than 1 minute 50 seconds). In the RTC this runs without error (it has been left running more that 17 minutes).

pageextension 50100 CustomerListExt extends "Customer List"
{
    trigger OnOpenPage();
    begin
        if Confirm('Run test?', false) then begin
            TestTimeOut();
        end;
    end;

    procedure TestTimeOut();
    var 
        startTime: DateTime;
        endTime: DateTime;
        Window: Dialog;

    begin
        Window.Open('Elapsed time: #1#############################');
        startTime := CurrentDateTime;

        while true do begin
            sleep(10000); //10 seconds
            endTime := CurrentDateTime;
            Window.Update(1, endTime - startTime);
        end;
    end;
}

You have branded this as Customer-Support, but as noted above I can duplicate it in BC. Please advise.

I am sure it is just a setting somewhere but I can't find it and I have doubled or tripled anything I could find.

Just wondering if there is any update on this?

I think I found the source of timeouts after 2 minutes. The reason is the default request timeout defined in aspnetcore module inside web.config.
To fix it locally add requestTimeout attribute to web.config (_C:\inetpub\wwwroot\NAV\web.config_):

<aspNetCore requestTimeout="00:20:00" processPath=".\Prod.Client.WebCoreApp.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true">

We will include this attribute in the future versions of the NAV platform builds.

I will test this out.

Looks, great, I have made it past 2 minutes for the first time ever. Thanks.

If you are using Docker, you can fix the issue by overriding the SetupWebConfiguration.ps1 script with this:

. "c:\run\SetupWebConfiguration.ps1"
Write-Host "Fixing requestTimeout in web.config"
[xml]$webconfig = Get-Content -Path "C:\inetpub\wwwroot\NAV\web.config"
$newattr = $webconfig.CreateAttribute("requestTimeout")
$newattr.Value = "12:00:00"
$webconfig.configuration.'system.webServer'.aspNetCore.Attributes.Append($newattr) | Out-Null
$webconfig.Save("C:\inetpub\wwwroot\NAV\web.config")

Can be done by adding

-myscripts @(@{'SetupWebConfiguration.ps1' = '. "c:\run\SetupWebConfiguration.ps1"
Write-Host "Fixing requestTimeout in web.config"
[xml]$webconfig = Get-Content -Path "C:\inetpub\wwwroot\NAV\web.config"
$newattr = $webconfig.CreateAttribute("requestTimeout")
$newattr.Value = "12:00:00"
$webconfig.configuration.''system.webServer''.aspNetCore.Attributes.Append($newattr) | Out-Null
$webconfig.Save("C:\inetpub\wwwroot\NAV\web.config")
'})

to new-navcontainer.

Only works until it is fixed in the NAV/BC though of course

Was this page helpful?
0 / 5 - 0 ratings