Configuration (reference)
Applies to version 0.2.1. The settings live in the application's configuration in the
GatewayClient section (GatewayClientOptions.SectionName) and are validated when the application
starts. If a setting breaks the rule in the “Valid” column, the application doesn't start, and the
message names every setting that is wrong.
| Setting | Default | Valid | Meaning |
|---|---|---|---|
BaseAddress | – | Required; absolute address with https, with http (from 0.3.0) only for this computer (localhost, 127.0.0.1, ::1) | Address of the service. Over http to another computer, the key would cross the network unencrypted; the client refuses this at startup and never sends such a request later either. If the service runs under a path (https://server/dataservice), the client adds the trailing slash itself |
ApiKeyEnvironmentVariable | WKL_GATEWAY_API_KEY | not empty | Name of the environment variable that holds the key |
ApiKeyHeader | X-Api-Key | not empty | Header for the key; must match the service's Gateway:Security:ApiKeyHeader |
CorrelationHeader | X-Request-Id | not empty | Header for the correlation ID; must match the header the service reads (its default is also X-Request-Id), otherwise the service assigns its own ID |
ReadTimeout | 15 s | greater than zero, at most 5 min | Time limit for reading (ReadAsync) |
WriteTimeout | 30 s | greater than zero, at most 5 min | Time limit for a procedure call (InvokeAsync). The name says “write” because a procedure call is how the client writes; it applies to every call, though, including one to a procedure that only reads |
MaxResponseBytes | 32 MiB | greater than zero | Largest response the client reads; a larger one ends with LimitExceeded if the service states the length in advance; otherwise reading stops at the limit and ends with Unavailable |
MaxUrlLength | 2,000 | not negative | Longest address used for a read request. A longer one is sent as POST …/$query with the options in the body; 0 sends every read request with options that way. The default follows the smallest common limit (by default, IIS accepts a query string of at most 2,048 bytes), because the client doesn't know which host sits in front of the service |
Time limits of the client and of the service. The service cancels a statement after its own time
limit (default 30 s) and reports TimedOut. If the client's time limit is shorter (as it is for
reading by default), the client stops waiting first and reports Unavailable; the statement keeps
running in the service until it finishes or is canceled. If you expect long read requests, set
ReadTimeout slightly above the service's time limit.
The key itself isn't a setting. Only the name of the environment variable is configured; the value is read for each request and never stored. A key in a configuration file is a key in the repository, in the container image, and in every backup of both.
Where to get it. You get the Wkl.Data.Gateway.Client package together with the data service,
from your provider's package feed; it isn't on nuget.org. It brings the contract package
Wkl.Data.Gateway.Contracts 0.6.0 as a dependency; both belong in the same package feed. This
documentation describes the client against a data service with contract 0.6.0. An older service
handles reading and calling the same way; what later contract versions add is then missing (see
Changes).