Is there a way to read the host settings in the host.json file at runtime? Say you have a host file like this:
{
"version": "2.0",
"extensions": {
"serviceBus": {
"messageHandlerOptions": {
"maxConcurrentCalls": 16
}
}
}
}
How do you then read the maxConcurrentCalls setting from your C# code?
It would be preferred if the default values were included too. You should get the same values as printed in the console on startup:
[28-01-2020 09:16:06] LoggerFilterOptions
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "MinLevel": "None",
[28-01-2020 09:16:06] "Rules": [
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "ProviderName": null,
[28-01-2020 09:16:06] "CategoryName": null,
[28-01-2020 09:16:06] "LogLevel": null,
[28-01-2020 09:16:06] "Filter": "<AddFilter>b__0"
[28-01-2020 09:16:06] },
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[28-01-2020 09:16:06] "CategoryName": null,
[28-01-2020 09:16:06] "LogLevel": "None",
[28-01-2020 09:16:06] "Filter": null
[28-01-2020 09:16:06] },
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[28-01-2020 09:16:06] "CategoryName": null,
[28-01-2020 09:16:06] "LogLevel": null,
[28-01-2020 09:16:06] "Filter": "<AddFilter>b__0"
[28-01-2020 09:16:06] }
[28-01-2020 09:16:06] ]
[28-01-2020 09:16:06] }
[28-01-2020 09:16:06] FunctionResultAggregatorOptions
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "BatchSize": 1000,
[28-01-2020 09:16:06] "FlushTimeout": "00:00:30",
[28-01-2020 09:16:06] "IsEnabled": true
[28-01-2020 09:16:06] }
[28-01-2020 09:16:06] SingletonOptions
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "LockPeriod": "00:00:15",
[28-01-2020 09:16:06] "ListenerLockPeriod": "00:00:15",
[28-01-2020 09:16:06] "LockAcquisitionTimeout": "10675199.02:48:05.4775807",
[28-01-2020 09:16:06] "LockAcquisitionPollingInterval": "00:00:05",
[28-01-2020 09:16:06] "ListenerLockRecoveryPollingInterval": "00:01:00"
[28-01-2020 09:16:06] }
[28-01-2020 09:16:06] ServiceBusOptions
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "PrefetchCount": 0,
[28-01-2020 09:16:06] "MessageHandlerOptions": {
[28-01-2020 09:16:06] "AutoComplete": true,
[28-01-2020 09:16:06] "MaxAutoRenewDuration": "00:05:00",
[28-01-2020 09:16:06] "MaxConcurrentCalls": 192
[28-01-2020 09:16:06] },
[28-01-2020 09:16:06] "SessionHandlerOptions": {
[28-01-2020 09:16:06] "AutoComplete": true,
[28-01-2020 09:16:06] "MaxAutoRenewDuration": "00:05:00",
[28-01-2020 09:16:06] "MaxConcurrentSessions": 2000,
[28-01-2020 09:16:06] "MessageWaitTimeout": "00:01:00"
[28-01-2020 09:16:06] },
[28-01-2020 09:16:06] "BatchOptions": {
[28-01-2020 09:16:06] "MaxMessageCount": 1000,
[28-01-2020 09:16:06] "OperationTimeout": "00:01:00",
[28-01-2020 09:16:06] "AutoComplete": true
[28-01-2020 09:16:06] }
[28-01-2020 09:16:06] }
[28-01-2020 09:16:06] HttpOptions
[28-01-2020 09:16:06] {
[28-01-2020 09:16:06] "DynamicThrottlesEnabled": false,
[28-01-2020 09:16:06] "MaxConcurrentRequests": -1,
[28-01-2020 09:16:06] "MaxOutstandingRequests": -1,
[28-01-2020 09:16:06] "RoutePrefix": "api"
[28-01-2020 09:16:06] }

local.settings.jsonfor getting it in runtime