首页 > 解决方案 > How can I override the host settings of my azure function locally?

问题描述

Say you have a host.json file like this:

{
  "version": "2.0",
  "extensions": {
    "serviceBus": {
      "messageHandlerOptions": {
        "maxConcurrentCalls": 16,
        "maxAutoRenewDuration": "00:05:00"
      }
    }
  }
}

But you wish to override the setting locally in local.settings.json or in the settings for a given environment on Azure. Is it possible, and how do you do it?

标签: azureazure-functionssettings

解决方案


It is possible, but poorly documented. Fabio Cavalcante describes it in a comment here.

You simply have to prefix the setting with AzureFunctionsJobHost in your local.settings.json file (or on Azure) like this:

{
  "IsEncrypted": false,
  "Values": {
    "AzureFunctionsJobHost:Extensions:ServiceBus:MessageHandlerOptions:MaxConcurrentCalls": 32,
    "AzureFunctionsJobHost:Extensions:ServiceBus:MessageHandlerOptions:MaxAutoRenewDuration": "00:10:00"
  }
}

You can also use double underscore (__) instead of colon (:).


推荐阅读