Modifier

Partager via


Session Timeout Settings and Configuration

When you start a client, such as connecting to Business Central in a browser, a connection is established with the Business Central Server instance and a corresponding session is added on Business Central Server.

Business Central Server includes several timeout settings that determine when a session closes as a result of inactivity over the client connection, lost client connection, or closing of the client. To help you configure the timeout settings, this document provides an overview of how the session timeouts work and answers some basic questions about session behavior.

Session timeout settings overview

This section provides an overview of the settings that are available in Business Central to control when a Business Central Server session for a Business Central client connection times out and closes. Some of the settings are set on Business Central Server and others are set for the Business Central Web client. For more details about using these settings, see the other sections in this topic.

Business Central Server timeout settings

The following table describes the session timeout settings that are used by Business Central Server.

Setting Description Remarks
ClientServicesReconnectPeriod The amount of time during which a client can reconnect to an existing session on Business Central Server before a session closes. For more information, see Configuring How Long a Session Remains Open after the Client Connection is Lost.
ClientServicesIdleClientTimeout The interval of time that a Business Central client connection can remain inactive before the session is closed. For more information, see Configuring How Long a Session Remains Open When the Client Connection is Inactive.

These settings are available in the CustomSettings.config file of Business Central Server. For more information about this file, see Configuring Business Central Server.

Business Central Web client timeout settings

The following table describes the session timeout settings that are used by the Business Central Web client.

Setting Description Remarks
SessionTimeout Specifies the amount of time that session remains open when there is no activity over the connection from the Business Central Web client to Business Central Server. For more information, see Configuring Business Central Server.

This setting is available in the navsettings.json configuration file of the Business Central Web Server. For more information about this file, see Configuring Web Server.

Configuring How Long a Session Remains Open When the Client Connection is Inactive

Inactivity on a connection is when the Business Central client is not sending messages to Business Central Server.

Configuring the inactive session timeout for the Business Central Web client

There are two settings that control when a Web client session closes because of inactivity on a connection:

  • ClientServicesIdleClientTimeout setting on Business Central Server.

  • SessionTimeout setting on the Business Central Web Server.

The session closes according to the setting that has the shortest time period. By default, the ClientServicesIdleClientTimeout setting is set to MaxValue, which means no time limit, and the SessionTimeout setting is 00:20:00 (20 minutes). This means that when client connection is inactive, a session will close after 20 minutes. The following figure illustrates the timeout behavior:

Inactivity session timeout.

Configuring How Long a Session Remains Open after the Client Connection is Lost

Occasionally, a Business Central client can lose the network connection to Business Central Server. You can use ClientServicesReconnectPeriod setting on Business Central Server to control how long a session remains open after the connection is lost to allow time for the client to reconnect to the session.

The time a session remains open actually depends two settings: ClientServicesKeepAliveInterval and ClientServicesReconnectPeriod. The ClientServicesKeepAliveInterval setting is used to specify an initial inactivity period. The initial inactivity period is equal to two times the ClientServicesKeepAliveInterval setting value. After this initial inactivity period, the session remains open for the time period that is specified ClientServicesReconnectPeriod setting. By default, the ClientServicesKeepAliveInterval setting is 120 seconds (2 minutes) and the ClientServicesReconnectPeriod setting is 10 minutes. This means that Business Central Server waits approximately 14 minutes for the client to reconnect before closing the session.

The following figure illustrates the reconnect session timeout behavior.

Reconnect session timeout.

The process that occurs when a client does not reconnect to the session is explained as follows:

  1. The connection is lost and the initial inactivity period starts (default is 4 minutes).

  2. After the initial inactivity period, the service channel enters a faulted state.

    When the service channel is in the faulted state, Business Central Server considers the session with the client as orphaned and waits for it to reconnect.

  3. If the client does not reconnect within the time period that is specified by the ClientServicesReconnectPeriod setting (default is 10 minutes), then Business Central Server closes the session.

  4. The session is then removed from the Active Session table in the Business Central.

FAQ

This section answers some typical questions about session timeout.

What happens to the session if the client loses the connection to Business Central Server?

By default, it will take approximately 14 minutes for the Business Central Server to close the current session. The time it takes to close the session is in part determined by the ClientServicesReconnectPeriod setting on Business Central Server plus an initial 10 minute inactivity period. For more information, see Configuring How Long a Session Remains Open after the Client Connection is Lost.

What happens if the session is still active when Business Central Server tries to close it?

  1. The server stops any executing threads when the next statement is to be executed and the current call stack is aborted so any uncommitted transactions will be rolled back.

  2. The server cancels any callbacks to the client (similar to waiting for the response to a Confirm dialog).

  3. The session is closed, and then removed from the Active Session table.