Skip to content

host.json

David Ebbo edited this page Mar 12, 2017 · 46 revisions

In the root script directory, there should be a host.json metadata file that contains the global configuration options affecting all functions. The Script runtime will map these settings into their corresponding WebHobs SDK JobHostConfiguration settings when initializing the host.

If you're running on Azure Functions, one of the easiest ways to edit your host.json is through App Service Editor. Simply navigate to https://<yourfunctionappname>.scm.azurewebsites.net/dev/wwwroot/host.json in your web browser.

Important: even though the sample below has comments to explain the settings, comments are not valid in JSON, and you should exclude them in your actual host.json.

{
    // The unique ID for this job host. Can be a lower case GUID
    // with dashes removed. When running in Azure Functions, the id can be omitted, and one gets generated automatically.
    "id": "9f4ea53c5136457d883d685e57164f08",
    // Value indicating the timeout duration for all functions.
    // In Dynamic SKUs, the valid range is from 1 second to 5 minutes and the default value is 5 minutes.
    // In Paid SKUs there is no limit and the default value is null (indicating no timeout).
    "functionTimeout": "00:05:00",
    // Configuration settings for 'http' triggers. (Optional)
    "http": {
        // Defines the default route prefix that applies to all routes. Default is 'api'.
        // Use an empty string to remove the prefix.
        "routePrefix": "api"
    },
    // Set of shared code directories that should be monitored for changes to ensure that
    // when code in these directories is changed, it is picked up by your functions
    "watchDirectories": [ "Shared" ],
    // Array of functions to load. Only functions in this list will be enabled.
    "functions": [ "QueueProcessor", "GitHubWebHook" ]
    // Configuration settings for 'queue' triggers. (Optional)
    "queues": {
      // The maximum interval in milliseconds between
      // queue polls. The default is 1 minute.
      "maxPollingInterval": 2000,
      // The number of queue messages to retrieve and process in
      // parallel (per job function). The default is 16 and the maximum is 32.
      "batchSize": 16,
      // The number of times to try processing a message before
      // moving it to the poison queue. The default is 5.
      "maxDequeueCount": 5,
      // The threshold at which a new batch of messages will be fetched.
      // The default is batchSize/2.
      "newBatchThreshold": 8
    },
    // Configuration settings for 'serviceBus' triggers. (Optional)
    "serviceBus": {
      // The maximum number of concurrent calls to the callback the message
      // pump should initiate. The default is 16.
      "maxConcurrentCalls": 16,
      // The default PrefetchCount that will be used by the underlying MessageReceiver.
      "prefetchCount": 100,
      // the maximum duration within which the message lock will be renewed automatically.
      "autoRenewTimeout": "00:05:00"
    },
    // Configuration settings for 'eventHub' triggers. (Optional)
    "eventHub": {
      // The maximum event count received per receive loop. The default is 64.
      "maxBatchSize": 64,
      // The default PrefetchCount that will be used by the underlying EventProcessorHost.
      "prefetchCount": 256
    },
    // Configuration settings for logging/tracing behavior. (Optional)
    "tracing": {
      // The tracing level used for console logging.
      // The default is 'info'. Options are: { off, error, warning, info, verbose }
      "consoleLevel": "verbose",
      // Value determining what level of file logging is enabled.
      // The default is 'debugOnly'. Options are: { never, always, debugOnly }
      "fileLoggingMode": "debugOnly"
    },
    // Configuration settings for Singleton lock behavior. (Optional)
    "singleton": {
      // The period that function level locks are taken for (they will auto renew)
      "lockPeriod": "00:00:15",
      // The period that listener locks are taken for
      "listenerLockPeriod": "00:01:00",
      // The time interval used for listener lock recovery if a listener lock
      // couldn't be acquired on startup
      "listenerLockRecoveryPollingInterval": "00:01:00",
      // The maximum amount of time the runtime will try to acquire a lock
      "lockAcquisitionTimeout": "00:01:00",
      // The interval between lock acquisition attempts
      "lockAcquisitionPollingInterval": "00:00:03"
    }
}

Learn

Azure Functions Basics

Advanced Concepts

Dotnet Functions

Java Functions

Node.js Functions

Python Functions

Host API's

Bindings

V2 Runtime

Contribute

Functions host

Language workers

Get Help

Other

Clone this wiki locally