IHostingSettings Interface
Aggregates all hosting-related settings for an HTTP service including URLs, proxy, CORS and compression configuration.
public interface IHostingSettingsRemarks
Section titled “Remarks”TryRead(IConfiguration) parses a configuration section (typically {ServiceName}:Http:Hosting)
into an IHostingSettings instance. The section may contain a simple comma-separated
Urls value or a full Kestrel Endpoints configuration – but not both.
Fields
Section titled “Fields”IHostingSettings.DEFAULT_ACCEPT_HEADER Field
Section titled “IHostingSettings.DEFAULT_ACCEPT_HEADER Field”The default value used for the Accept request header when a request does not include one or sends an empty value.
const string DEFAULT_ACCEPT_HEADER = "application/json";Field Value
Section titled “Field Value”Properties
Section titled “Properties”IHostingSettings.CompressionSettings Property
Section titled “IHostingSettings.CompressionSettings Property”Gets the compression settings that control request decompression and response compression.
HAKOM.Http.Core.Net.Api.ICompressionSettings CompressionSettings { get; }Property Value
Section titled “Property Value”IHostingSettings.CorsSettings Property
Section titled “IHostingSettings.CorsSettings Property”Gets the CORS settings that define which cross-origin requests are allowed.
HAKOM.Http.Core.Net.Api.ICorsSettings CorsSettings { get; }Property Value
Section titled “Property Value”IHostingSettings.DefaultAcceptHeader Property
Section titled “IHostingSettings.DefaultAcceptHeader Property”Gets the media type to use as the default Accept header for requests that do not include one or send an empty (or whitespace-only) value.
HAKOM.Http.Core.Net.Api.IDefaultAcceptHeader DefaultAcceptHeader { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”The default value is application/json. Override it via the DefaultAcceptHeader setting of the
service’s Http:Hosting configuration section (i.e. <service-name>:Http:Hosting:DefaultAcceptHeader).
A configured value that is not a valid media type causes TryRead(IConfiguration) to fail with an
InvalidDefaultAcceptHeaderException rather than being silently replaced with the default.
IHostingSettings.Defaults Property
Section titled “IHostingSettings.Defaults Property”Gets the default hosting settings that listen on http://localhost:5000 with no proxy, CORS or compression.
static HAKOM.Http.Core.Net.Api.IHostingSettings Defaults { get; }Property Value
Section titled “Property Value”IHostingSettings.Key Property
Section titled “IHostingSettings.Key Property”The configuration key under which hosting settings are expected.
static string Key { get; }Property Value
Section titled “Property Value”IHostingSettings.ProxySettings Property
Section titled “IHostingSettings.ProxySettings Property”Gets the proxy settings that control forwarded header handling and path-base rewriting.
HAKOM.Http.Core.Net.Api.IProxySettings ProxySettings { get; }Property Value
Section titled “Property Value”IHostingSettings.SupportedCultures Property
Section titled “IHostingSettings.SupportedCultures Property”Array of cultures supported via Accept-Language header.
System.Collections.Generic.IEnumerable<System.Globalization.CultureInfo> SupportedCultures { get; }Property Value
Section titled “Property Value”System.Collections.Generic.IEnumerable<System.Globalization.CultureInfo>
Remarks
Section titled “Remarks”If the array is empty, the service will not attempt to determine the culture from the Accept-Language header and will instead use the service culture for all requests.
IHostingSettings.Urls Property
Section titled “IHostingSettings.Urls Property”Gets the list of URLs (or endpoints) under which the service should be accessible.
System.Collections.Generic.IReadOnlyList<string> Urls { get; }Property Value
Section titled “Property Value”System.Collections.Generic.IReadOnlyList<System.String>
Methods
Section titled “Methods”IHostingSettings.TryRead(IConfiguration) Method
Section titled “IHostingSettings.TryRead(IConfiguration) Method”Attempts to read hosting settings from the specified configuration.
static HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.Http.Core.Net.Api.IHostingSettings> TryRead(Microsoft.Extensions.Configuration.IConfiguration configuration);Parameters
Section titled “Parameters”configuration Microsoft.Extensions.Configuration.IConfiguration
The Microsoft.Extensions.Configuration.IConfiguration to read from.
Returns
Section titled “Returns”HAKOM.ErrorHandling.Core.Net.Api.Result<IHostingSettings>
A Result<TValue> containing the parsed IHostingSettings or an error.