適用於 Azure Functions 1.x 的 host.json 參考host.json reference for Azure Functions 1.x

host.json 中繼資料檔案所包含的全域設定選項會影響函式應用程式的所有函式。The host.json metadata file contains global configuration options that affect all functions for a function app. 本文列出 v1 執行階段可用的設定。This article lists the settings that are available for the v1 runtime. JSON 結構描述位於 http://json.schemastore.org/hostThe JSON schema is at http://json.schemastore.org/host.

注意

本文適用於 Azure Functions 1.x。This article is for Azure Functions 1.x. 有關 Functions 2.x 中 host.json 的參考,請參閱適用於 Azure Functions 2.x 的 host.json 參考For a reference of host.json in Functions 2.x, see host.json reference for Azure Functions 2.x.

其他函數應用程式設定選項的管理是在應用程式設定中進行。Other function app configuration options are managed in your app settings.

有些 host.json 設定只有在本機執行時,才會在 local.settings.json 檔案中使用。Some host.json settings are only used when running locally in the local.settings.json file.

範例 host.json 檔案Sample host.json file

下列範例 host.json 檔案已指定所有可能的選項。The following sample host.json files have all possible options specified.

{
    "aggregator": {
        "batchSize": 1000,
        "flushTimeout": "00:00:30"
    },
    "applicationInsights": {
        "sampling": {
          "isEnabled": true,
          "maxTelemetryItemsPerSecond" : 5
        }
    },
    "documentDB": {
        "connectionMode": "Gateway",
        "protocol": "Https",
        "leaseOptions": {
            "leasePrefix": "prefix"
        }
    },
    "eventHub": {
      "maxBatchSize": 64,
      "prefetchCount": 256,
      "batchCheckpointFrequency": 1
    },
    "functions": [ "QueueProcessor", "GitHubWebHook" ],
    "functionTimeout": "00:05:00",
    "healthMonitor": {
        "enabled": true,
        "healthCheckInterval": "00:00:10",
        "healthCheckWindow": "00:02:00",
        "healthCheckThreshold": 6,
        "counterThreshold": 0.80
    },
    "http": {
        "routePrefix": "api",
        "maxOutstandingRequests": 20,
        "maxConcurrentRequests": 10,
        "dynamicThrottlesEnabled": false
    },
    "id": "9f4ea53c5136457d883d685e57164f08",
    "logger": {
        "categoryFilter": {
            "defaultLevel": "Information",
            "categoryLevels": {
                "Host": "Error",
                "Function": "Error",
                "Host.Aggregator": "Information"
            }
        }
    },
    "queues": {
      "maxPollingInterval": 2000,
      "visibilityTimeout" : "00:00:30",
      "batchSize": 16,
      "maxDequeueCount": 5,
      "newBatchThreshold": 8
    },
    "sendGrid": {
        "from": "Contoso Group <admin@contoso.com>"
    },
    "serviceBus": {
      "maxConcurrentCalls": 16,
      "prefetchCount": 100,
      "autoRenewTimeout": "00:05:00"
    },
    "singleton": {
      "lockPeriod": "00:00:15",
      "listenerLockPeriod": "00:01:00",
      "listenerLockRecoveryPollingInterval": "00:01:00",
      "lockAcquisitionTimeout": "00:01:00",
      "lockAcquisitionPollingInterval": "00:00:03"
    },
    "tracing": {
      "consoleLevel": "verbose",
      "fileLoggingMode": "debugOnly"
    },
    "watchDirectories": [ "Shared" ],
}

本文的下列各節說明每個最上層屬性。The following sections of this article explain each top-level property. 除非另有說明,否則全部都是選擇項目。All are optional unless otherwise indicated.

aggregatoraggregator

指定計算 Application Insights 的計量時彙總多少函式引動過程。Specifies how many function invocations are aggregated when calculating metrics for Application Insights.

{
    "aggregator": {
        "batchSize": 1000,
        "flushTimeout": "00:00:30"
    }
}
屬性Property 預設Default 描述Description
batchSizebatchSize 10001000 要彙總的要求數目上限。Maximum number of requests to aggregate.
flushTimeoutflushTimeout 00:00:3000:00:30 要彙總的最長期間。Maximum time period to aggregate.

達到兩個限制的第一個限制時,會彙總函式引動過程。Function invocations are aggregated when the first of the two limits are reached.

applicationInsightsapplicationInsights

控制 Application Insights 中的取樣功能Controls the sampling feature in Application Insights.

{
    "applicationInsights": {
        "sampling": {
          "isEnabled": true,
          "maxTelemetryItemsPerSecond" : 5
        }
    }
}
屬性Property 預設Default 描述Description
isEnabledisEnabled truetrue 啟用或停用取樣。Enables or disables sampling.
maxTelemetryItemsPerSecondmaxTelemetryItemsPerSecond 55 取樣的開始臨界值。The threshold at which sampling begins.

DocumentDBDocumentDB

Azure Cosmos DB 觸發程式和系結的設定。Configuration settings for the Azure Cosmos DB trigger and bindings.

{
    "documentDB": {
        "connectionMode": "Gateway",
        "protocol": "Https",
        "leaseOptions": {
            "leasePrefix": "prefix1"
        }
    }
}
屬性Property 預設Default 描述Description
GatewayModeGatewayMode 閘道Gateway 連線到 Azure Cosmos DB 服務時函式所使用的連線模式。The connection mode used by the function when connecting to the Azure Cosmos DB service. 選項為 DirectGatewayOptions are Direct and Gateway
ProtocolProtocol HttpsHttps 連線到 Azure Cosmos DB 服務時函式所使用的連線通訊協定。The connection protocol used by the function when connection to the Azure Cosmos DB service. 請參閱此處以了解這兩種模式Read here for an explanation of both modes
leasePrefixleasePrefix n/an/a 要在應用程式的所有函式上使用的租用前置詞。Lease prefix to use across all functions in an app.

durableTaskdurableTask

Durable Functions 的組態設定。Configuration settings for Durable Functions.

{
  "durableTask": {
    "hubName": "MyTaskHub",
    "controlQueueBatchSize": 32,
    "partitionCount": 4,
    "controlQueueVisibilityTimeout": "00:05:00",
    "workItemQueueVisibilityTimeout": "00:05:00",
    "maxConcurrentActivityFunctions": 10,
    "maxConcurrentOrchestratorFunctions": 10,
    "maxQueuePollingInterval": "00:00:30",
    "azureStorageConnectionStringName": "AzureWebJobsStorage",
    "trackingStoreConnectionStringName": "TrackingStorage",
    "trackingStoreNamePrefix": "DurableTask",
    "traceInputsAndOutputs": false,
    "logReplayEvents": false,
    "eventGridTopicEndpoint": "https://topic_name.westus2-1.eventgrid.azure.net/api/events",
    "eventGridKeySettingName":  "EventGridKey",
    "eventGridPublishRetryCount": 3,
    "eventGridPublishRetryInterval": "00:00:30",
    "eventGridPublishEventTypes": ["Started", "Completed", "Failed", "Terminated"]
  }
}

工作中樞名稱必須以字母開頭,且只包含字母和數字。Task hub names must start with a letter and consist of only letters and numbers. 如果未指定,函式應用程式的預設工作中樞名稱是 DurableFunctionsHubIf not specified, the default task hub name for a function app is DurableFunctionsHub. 如需詳細資訊,請參閱工作中樞For more information, see Task hubs.

屬性Property 預設Default 描述Description
hubNamehubName DurableFunctionsHubDurableFunctionsHub 替代工作中樞名稱可用來彼此隔離多個 Durable Functions 應用程式,即使它們使用相同的儲存體後端。Alternate task hub names can be used to isolate multiple Durable Functions applications from each other, even if they're using the same storage backend.
controlQueueBatchSizecontrolQueueBatchSize 3232 要從控制佇列中一次提取的訊息數。The number of messages to pull from the control queue at a time.
partitionCountpartitionCount 44 控制佇列的資料分割計數。The partition count for the control queue. 必須是介於 1 到 16 之間的正整數。May be a positive integer between 1 and 16.
controlQueueVisibilityTimeoutcontrolQueueVisibilityTimeout 5 分鐘5 minutes 已從控制佇列中清除之訊息的可見度逾時。The visibility timeout of dequeued control queue messages.
workItemQueueVisibilityTimeoutworkItemQueueVisibilityTimeout 5 分鐘5 minutes 已從工作項目佇列中清除之訊息的可見度逾時。The visibility timeout of dequeued work item queue messages.
maxConcurrentActivityFunctionsmaxConcurrentActivityFunctions 目前電腦上的 10 倍處理器數目10X the number of processors on the current machine 可以在單一主機執行個體上同時處理的活動函式數目上限。The maximum number of activity functions that can be processed concurrently on a single host instance.
maxConcurrentOrchestratorFunctionsmaxConcurrentOrchestratorFunctions 目前電腦上的 10 倍處理器數目10X the number of processors on the current machine 可以在單一主機執行個體上同時處理的協調器函式數目上限。The maximum number of orchestrator functions that can be processed concurrently on a single host instance.
maxQueuePollingIntervalmaxQueuePollingInterval 30 秒30 seconds 最大的控制和工作項目佇列中的輪詢間隔hh: mm: 格式。The maximum control and work-item queue polling interval in the hh:mm:ss format. 較高的值可能會導致較高的訊息處理延遲。Higher values can result in higher message processing latencies. 較低的值會導致較高的儲存體成本,因為增加的儲存體交易。Lower values can result in higher storage costs because of increased storage transactions.
azureStorageConnectionStringNameazureStorageConnectionStringName AzureWebJobsStorageAzureWebJobsStorage 具有 Azure 儲存體連接字串的應用程式設定名稱,而該連接字串用來管理基礎的 Azure 儲存體資源。The name of the app setting that has the Azure Storage connection string used to manage the underlying Azure Storage resources.
trackingStoreConnectionStringNametrackingStoreConnectionStringName 歷程記錄和執行個體資料表中使用的連接字串名稱。The name of a connection string to use for the History and Instances tables. 如果未指定,azureStorageConnectionStringName使用連接。If not specified, the azureStorageConnectionStringName connection is used.
trackingStoreNamePrefixtrackingStoreNamePrefix 歷程記錄和執行個體所使用的前置詞資料表的時機trackingStoreConnectionStringName指定。The prefix to use for the History and Instances tables when trackingStoreConnectionStringName is specified. 如果未設定,此預設前置詞值會是DurableTaskIf not set, the default prefix value will be DurableTask. 如果trackingStoreConnectionStringName未指定,則會使用 記錄 和 執行個體資料表hubName值作為其前置詞和任何設定trackingStoreNamePrefix將會被忽略。If trackingStoreConnectionStringName is not specified, then the History and Instances tables will use the hubName value as their prefix, and any setting for trackingStoreNamePrefix will be ignored.
traceInputsAndOutputstraceInputsAndOutputs falsefalse 此值指出是否要追蹤函式呼叫的輸入和輸出。A value indicating whether to trace the inputs and outputs of function calls. 追蹤函式執行事件時的預設行為就是在函式呼叫的序列化輸入和輸出中包含位元組數目。The default behavior when tracing function execution events is to include the number of bytes in the serialized inputs and outputs for function calls. 此行為可提供的輸入和輸出如下所示而不需要膨脹記錄檔,或不小心公開機密資訊的基本資訊。This behavior provides minimal information about what the inputs and outputs look like without bloating the logs or inadvertently exposing sensitive information. 將此屬性設定為 true,會導致預設函式記錄功能記錄函式輸入和輸出的整個內容。Setting this property to true causes the default function logging to log the entire contents of function inputs and outputs.
logReplayEventslogReplayEvents falsefalse 此值可指出是否要將協調流程重新執行事件寫入 Application Insights。A value indicating whether to write orchestration replay events to Application Insights.
eventGridTopicEndpointeventGridTopicEndpoint Azure 事件方格自訂主題端點的 URL。The URL of an Azure Event Grid custom topic endpoint. 當設定這個屬性時,就會將協調流程生命週期通知事件發佈到此端點。When this property is set, orchestration life-cycle notification events are published to this endpoint. 這個屬性支援應用程式設定解析。This property supports App Settings resolution.
eventGridKeySettingNameeventGridKeySettingName 應用程式設定的名稱,其中包含在 EventGridTopicEndpoint 用來向 Azure 事件方格自訂主題進行驗證的金鑰。The name of the app setting containing the key used for authenticating with the Azure Event Grid custom topic at EventGridTopicEndpoint.
eventGridPublishRetryCounteventGridPublishRetryCount 00 如果發佈到 Event Grid 主題失敗,重試的次數。The number of times to retry if publishing to the Event Grid Topic fails.
eventGridPublishRetryIntervaleventGridPublishRetryInterval 5 分鐘5 minutes 「事件方格」會以 hh:mm:ss 格式發佈重試間隔。The Event Grid publishes retry interval in the hh:mm:ss format.
eventGridPublishEventTypeseventGridPublishEventTypes 若要發佈至 Event Grid 的事件類型的清單。A list of event types to publish to Event Grid. 如果未指定,就會發行所有事件類型。If not specified, all event types will be published. 允許的值包括StartedCompletedFailedTerminatedAllowed values include Started, Completed, Failed, Terminated.

許多這些設定會將效能最佳化。Many of these settings are for optimizing performance. 如需詳細資訊,請參閱效能和級別For more information, see Performance and scale.

eventHubeventHub

事件中樞觸發程序和繫結的組態設定。Configuration settings for Event Hub triggers and bindings.

{
    "eventHub": {
      "maxBatchSize": 64,
      "prefetchCount": 256,
      "batchCheckpointFrequency": 1
    }
}
屬性Property 預設值Default 描述Description
maxBatchSizemaxBatchSize 6464 每個接收迴圈接收到的事件計數上限。The maximum event count received per receive loop.
prefetchCountprefetchCount n/an/a 基礎 EventProcessorHost 將使用的預設 PrefetchCount。The default PrefetchCount that will be used by the underlying EventProcessorHost.
batchCheckpointFrequencybatchCheckpointFrequency 11 要在建立 EventHub 資料指標檢查點之前處理的事件批次數目。The number of event batches to process before creating an EventHub cursor checkpoint.

函數functions

工作主機所執行的函式清單。A list of functions that the job host runs. 空陣列表示已執行所有函式。An empty array means run all functions. 預定只能在本機執行時使用。Intended for use only when running locally. 在 Azure 的函數應用程式中,您應該改為依照如何停用 Azure Functions 中的函式中的步驟來停用特定函式,而不是使用此設定。In function apps in Azure, you should instead follow the steps in How to disable functions in Azure Functions to disable specific functions rather than using this setting.

{
    "functions": [ "QueueProcessor", "GitHubWebHook" ]
}

functionTimeoutfunctionTimeout

指出所有函式的逾時持續期間。Indicates the timeout duration for all functions. 在無伺服器的使用情況方案中,有效範圍是從 1 秒到 10 分鐘,而預設值是 5 分鐘。In a serverless Consumption plan, the valid range is from 1 second to 10 minutes, and the default value is 5 minutes. 在 App Service 方案中,並沒有整體限制,而預設值則是取決於執行階段版本。In an App Service plan, there is no overall limit and the default depends on the runtime version.

{
    "functionTimeout": "00:05:00"
}

healthMonitorhealthMonitor

主機健康情況監視器的組態設定。Configuration settings for Host health monitor.

{
    "healthMonitor": {
        "enabled": true,
        "healthCheckInterval": "00:00:10",
        "healthCheckWindow": "00:02:00",
        "healthCheckThreshold": 6,
        "counterThreshold": 0.80
    }
}
屬性Property 預設Default 描述Description
enabledenabled truetrue 指定是否已啟用此功能。Specifies whether the feature is enabled.
healthCheckIntervalhealthCheckInterval 10 秒10 seconds 定期背景健康情況檢查之間的時間間隔。The time interval between the periodic background health checks.
healthCheckWindowhealthCheckWindow 2 分鐘2 minutes healthCheckThreshold 設定搭配使用的滑動時間範圍。A sliding time window used in conjunction with the healthCheckThreshold setting.
healthCheckThresholdhealthCheckThreshold 66 在主機回收起始之前,健康情況檢查可以失敗的最大次數。Maximum number of times the health check can fail before a host recycle is initiated.
counterThresholdcounterThreshold 0.800.80 系統會將效能計數器視為狀況不良的閾值。The threshold at which a performance counter will be considered unhealthy.

httphttp

HTTP 觸發程序和繫結的組態設定。Configuration settings for http triggers and bindings.

{
    "http": {
        "routePrefix": "api",
        "maxOutstandingRequests": 200,
        "maxConcurrentRequests": 100,
        "dynamicThrottlesEnabled": true
    }
}
屬性Property 預設Default 描述Description
routePrefixroutePrefix apiapi 適用於所有路由的路由前置詞。The route prefix that applies to all routes. 若要移除預設前置詞,請使用空字串。Use an empty string to remove the default prefix.
maxOutstandingRequestsmaxOutstandingRequests 200*200* 在任何指定時間保留的未完成要求數目上限。The maximum number of outstanding requests that are held at any given time. 此限制包括已排入佇列但尚未開始執行的要求,以及任何進行中的執行。This limit includes requests that are queued but have not started executing, as well as any in progress executions. 會以 429「忙碌」回應來拒絕任何超過此限制的連入要求。Any incoming requests over this limit are rejected with a 429 "Too Busy" response. 這樣可讓呼叫者採用以時間為基礎的重試策略,並且也協助您控制要求延遲的上限。That allows callers to employ time-based retry strategies, and also helps you to control maximum request latencies. 此動作只會控制在指令碼主機執行路徑內發生的佇列處理。This only controls queuing that occurs within the script host execution path. 其他佇列 (例如 ASP.NET 要求佇列) 仍然有效,且不受此設定的影響。Other queues such as the ASP.NET request queue will still be in effect and unaffected by this setting. *預設版本 1.x 未繫結 (-1)。*The default for version 1.x is unbounded (-1). 在取用方案中,版本 2.x 的預設值是 200。The default for version 2.x in a consumption plan is 200. 預設版本 2.x 專用的方案中未繫結 (-1)。The default for version 2.x in a dedicated plan is unbounded (-1).
maxConcurrentRequestsmaxConcurrentRequests 100*100* 要平行執行的 HTTP 函式數目上限。The maximum number of http functions that will be executed in parallel. 這可讓您控制並行作業,幫助您管理資源使用率。This allows you to control concurrency, which can help manage resource utilization. 例如,您可能會有使用大量系統資源 (記憶體/CPU/通訊端) 的 HTTP 函式,以致於並行率太高時會造成問題。For example, you might have an http function that uses a lot of system resources (memory/cpu/sockets) such that it causes issues when concurrency is too high. 或者,如果函式對第三方服務發出傳出要求,則需要限制這些呼叫的速率。Or you might have a function that makes outbound requests to a third party service, and those calls need to be rate limited. 在這些情況下,套用節流會有所幫助。In these cases, applying a throttle here can help. *預設版本 1.x 未繫結 (-1)。*The default for version 1.x is unbounded (-1). 在取用方案中,版本 2.x 的預設值是 100。The default for version 2.x in a consumption plan is 100. 預設版本 2.x 專用的方案中未繫結 (-1)。The default for version 2.x in a dedicated plan is unbounded (-1).
dynamicThrottlesEnableddynamicThrottlesEnabled true*true* 啟用時,此設定會促使要求處理管線定期檢查系統效能計數器,例如連線/執行緒/處理程序/記憶體/CPU/其他,而且如果這些計數器中任一個超過內建的臨界值上限 (80%),則要求會遭到拒絕,並包含 429「忙碌」的回應,直到計數器回到正常水平。When enabled, this setting causes the request processing pipeline to periodically check system performance counters like connections/threads/processes/memory/cpu/etc. and if any of those counters are over a built-in high threshold (80%), requests will be rejected with a 429 "Too Busy" response until the counter(s) return to normal levels. *預設版本 1.x 為 false。*The default for version 1.x is false. 在取用方案中,版本 2.x 的預設值是 true。The default for version 2.x in a consumption plan is true. 在專屬方案中,版本 2.x 的預設值是 false。The default for version 2.x in a dedicated plan is false.

idid

僅限 1.x 版。Version 1.x only.

作業主機的唯一識別碼。The unique ID for a job host. 可以是已移除虛線的小寫 GUID。Can be a lower case GUID with dashes removed. 在本機執行時為必要項目。Required when running locally. 在 Azure 中執行時,建議您不要設定識別碼值。When running in Azure, we recommend that you not set an ID value. 當省略 id 時,在 Azure 中會自動產生識別碼。An ID is generated automatically in Azure when id is omitted.

如果您在多個函數應用程式中共用儲存體帳戶,請確定每個函數應用程式具有不同的 idIf you share a Storage account across multiple function apps, make sure that each function app has a different id. 您可以省略 id 屬性或將每個函數應用程式的 id 手動設定為不同的值。You can omit the id property or manually set each function app's id to a different value. 計時器觸發程序會使用儲存體鎖定,以確保當函數應用程式相應放大至多個執行個體時,只會有一個計時器執行個體。The timer trigger uses a storage lock to ensure that there will be only one timer instance when a function app scales out to multiple instances. 如果兩個函數應用程式共用相同的 id,且每一個都是使用計時器觸發程序,則只有一個計時器會執行。If two function apps share the same id and each uses a timer trigger, only one timer will run.

{
    "id": "9f4ea53c5136457d883d685e57164f08"
}

loggerlogger

控制 ILogger 物件context.log 所寫入記錄的篩選。Controls filtering for logs written by an ILogger object or by context.log.

{
    "logger": {
        "categoryFilter": {
            "defaultLevel": "Information",
            "categoryLevels": {
                "Host": "Error",
                "Function": "Error",
                "Host.Aggregator": "Information"
            }
        }
    }
}
屬性Property 預設Default 描述Description
categoryFiltercategoryFilter n/an/a 指定依類別的篩選Specifies filtering by category
defaultLeveldefaultLevel InformationInformation 針對 categoryLevels 陣列中未指定的任何類別,會將這個層級和以上層級的記錄傳送至 Application Insights。For any categories not specified in the categoryLevels array, send logs at this level and above to Application Insights.
categoryLevelscategoryLevels n/an/a 一個類別陣列,指定針對每個類別傳送至 Application Insights 的最小記錄層級。An array of categories that specifies the minimum log level to send to Application Insights for each category. 這裡指定的類別控制所有開頭為相同值的類別,但會優先使用較長的值。The category specified here controls all categories that begin with the same value, and longer values take precedence. 在上述範例 host.json 檔案中,所有開頭為 "Host.Aggregator" 的類別都會記錄在 Information 層級。In the preceding sample host.json file, all categories that begin with "Host.Aggregator" log at Information level. 所有開頭為 "Host" 的其他類別 (例如 "Host.Executor") 都會記錄於 Error 層級。All other categories that begin with "Host", such as "Host.Executor", log at Error level.

queuesqueues

儲存體佇列觸發程序和繫結的組態設定。Configuration settings for Storage queue triggers and bindings.

{
    "queues": {
      "maxPollingInterval": 2000,
      "visibilityTimeout" : "00:00:30",
      "batchSize": 16,
      "maxDequeueCount": 5,
      "newBatchThreshold": 8
    }
}
屬性Property 預設Default 描述Description
maxPollingIntervalmaxPollingInterval 6000060000 佇列輪詢之間的間隔上限 (毫秒)。The maximum interval in milliseconds between queue polls.
visibilityTimeoutvisibilityTimeout 00 處理訊息失敗時,重試之間的時間間隔。The time interval between retries when processing of a message fails.
batchSizebatchSize 1616 Functions 執行階段會同時擷取,並以平行方式處理的佇列訊息數目。The number of queue messages that the Functions runtime retrieves simultaneously and processes in parallel. 當要處理的數目減少到 newBatchThreshold 時,執行階段就會取得另一個批次,並開始處理那些訊息。When the number being processed gets down to the newBatchThreshold, the runtime gets another batch and starts processing those messages. 因此,每個函式並行處理之訊息的上限為 batchSize 加上 newBatchThresholdSo the maximum number of concurrent messages being processed per function is batchSize plus newBatchThreshold. 這項限制個別套用至每個佇列觸發的函式。This limit applies separately to each queue-triggered function.

如果您需要避免平行執行在單一佇列上收到的訊息,可以將 batchSize 設定為 1。If you want to avoid parallel execution for messages received on one queue, you can set batchSize to 1. 不過,只要您的函式應用程式在單一虛擬機器 (VM) 上執行,這項設定就只會將並行排除。However, this setting eliminates concurrency only so long as your function app runs on a single virtual machine (VM). 如果函式應用程式相應放大為多個 VM,則每個 VM 可以執行每個佇列觸發之函式的一個執行個體。If the function app scales out to multiple VMs, each VM could run one instance of each queue-triggered function.

最大值 batchSize 為 32。The maximum batchSize is 32.
maxDequeueCountmaxDequeueCount 55 將訊息移至有害佇列之前,嘗試處理訊息的次數。The number of times to try processing a message before moving it to the poison queue.
newBatchThresholdnewBatchThreshold batchSize/2batchSize/2 每當要同時處理的訊息數目下降至這個數字時,執行階段就會擷取另一個批次。Whenever the number of messages being processed concurrently gets down to this number, the runtime retrieves another batch.

SendGridSendGrid

SendGrind 輸出系結的設定Configuration setting for the SendGrind output binding

{
    "sendGrid": {
        "from": "Contoso Group <admin@contoso.com>"
    }
屬性Property 預設Default 描述Description
寄件者from n/an/a 所有函式的寄件者電子郵件地址。The sender's email address across all functions.

serviceBusserviceBus

服務匯流排觸發程序和繫結的組態設定。Configuration setting for Service Bus triggers and bindings.

{
    "serviceBus": {
      "maxConcurrentCalls": 16,
      "prefetchCount": 100,
      "autoRenewTimeout": "00:05:00"
    }
}
屬性Property 預設Default 描述Description
maxConcurrentCallsmaxConcurrentCalls 1616 訊息幫浦應該起始之回呼的並行呼叫數上限。The maximum number of concurrent calls to the callback that the message pump should initiate. Functions 執行階段預設會並行處理多個訊息。By default, the Functions runtime processes multiple messages concurrently. 若要指示執行階段一次只處理一個佇列或主題訊息,請將 maxConcurrentCalls 設定為 1。To direct the runtime to process only a single queue or topic message at a time, set maxConcurrentCalls to 1.
prefetchCountprefetchCount n/an/a 基礎 MessageReceiver 將使用的預設 PrefetchCount。The default PrefetchCount that will be used by the underlying MessageReceiver.
autoRenewTimeoutautoRenewTimeout 00:05:0000:05:00 將自動更新訊息鎖定的最大持續時間。The maximum duration within which the message lock will be renewed automatically.

singletonsingleton

Singleton 鎖定行為的組態設定。Configuration settings for Singleton lock behavior. 如需詳細資訊,請參閱單一支援的 GitHub 問題For more information, see GitHub issue about singleton support.

{
    "singleton": {
      "lockPeriod": "00:00:15",
      "listenerLockPeriod": "00:01:00",
      "listenerLockRecoveryPollingInterval": "00:01:00",
      "lockAcquisitionTimeout": "00:01:00",
      "lockAcquisitionPollingInterval": "00:00:03"
    }
}
屬性Property 預設Default 描述Description
lockPeriodlockPeriod 00:00:1500:00:15 取得函式層級鎖定的期間。The period that function level locks are taken for. 鎖定會自動更新。The locks auto-renew.
listenerLockPeriodlistenerLockPeriod 00:01:0000:01:00 接聽程式鎖定所需的期間。The period that listener locks are taken for.
listenerLockRecoveryPollingIntervallistenerLockRecoveryPollingInterval 00:01:0000:01:00 啟動時無法取得接聽程式鎖定時,用於接聽程式鎖定復原的時間間隔。The time interval used for listener lock recovery if a listener lock couldn't be acquired on startup.
lockAcquisitionTimeoutlockAcquisitionTimeout 00:01:0000:01:00 執行階段將嘗試取得鎖定的時間量上限。The maximum amount of time the runtime will try to acquire a lock.
lockAcquisitionPollingIntervallockAcquisitionPollingInterval n/an/a 鎖定取得嘗試之間的間隔。The interval between lock acquisition attempts.

tracingtracing

1.x 版Version 1.x

使用 TraceWriter 物件所建立記錄的組態設定。Configuration settings for logs that you create by using a TraceWriter object. 請參閱 C# 記錄Node.js 記錄See C# Logging and Node.js Logging.

{
    "tracing": {
      "consoleLevel": "verbose",
      "fileLoggingMode": "debugOnly"
    }
}
屬性Property 預設Default 描述Description
consoleLevelconsoleLevel 資訊info 主控台記錄的追蹤層級。The tracing level for console logging. 選項為:offerrorwarninginfoverboseOptions are: off, error, warning, info, and verbose.
fileLoggingModefileLoggingMode debugOnlydebugOnly 檔案記錄的追蹤層級。The tracing level for file logging. 選項為 neveralwaysdebugOnlyOptions are never, always, debugOnly.

watchDirectorieswatchDirectories

應該監視其變更的一組共用程式碼目錄A set of shared code directories that should be monitored for changes. 請確定,這些目錄中的程式碼變更時,函式會反映變更。Ensures that when code in these directories is changed, the changes are picked up by your functions.

{
    "watchDirectories": [ "Shared" ]
}

後續步驟Next steps