NavHttpClient Request Failed

rocatisrocatis Member Posts: 163
I get this error when executing a HTTP Client Request from BC Code: "Code: 0, Message: NavHttpClient Request Failed, Error: The operation was canceled.". The error is thrown after what looks like (more or less) precisely 2 minutes. If I limit my request in BC so that it takes less than 2 minutes, it completes without errors.

If I send the exact same (full) request from Postman, it succeeds after about 4 minutes.

I've tried changing all 2 minute timeout values found in the Business Central Administration to 1:02:00, but to no avail:
  • Client Services/Keep Alive Interval
  • OData Services/DeltaServiceClientTimeout
  • Asynchronous Processing/Page Background Task Default Timeout

Per default, Postman does not impose a timeout (File/Settings/Request timeout in ms is 0). If I change that to e.g. 10 seconds, Postman throws an error as expected: "Error: Response timed out/ESOCKETTIMEDOUT".

In Postman, two keys are set in the header: "Connection = keep-alive" and "Accept = */*". I am sending those from BC as well.

I'm convinced the issue is somehow related to a 2 minute timeout somewhere - please help me find it!
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup

Answers

  • navgirl2012navgirl2012 Member Posts: 2
    did you find the issue? i am having the same problem
  • rocatisrocatis Member Posts: 163
    Var
    Client: HttpClient;

    Client.Timeout := 5 * 60 * 1000; // 5 minutes timeout

    What you should note is that the max. setting is determined by the NavHttpClientMaxTimeout setting on the servicetier. This is also 2 minutes by default. If you try to set the value in code to anything larger than the setting on the servicetier, you get a runtime error.
    Brian Rocatis
    Senior NAV Developer
    Elbek & Vejrup
Sign In or Register to comment.