How to add configuration values in AppSettings.json in Azure functions. Is there any structure for it?

后端 未结 7 2098
别那么骄傲
别那么骄傲 2021-02-12 18:51

What is the standard structure to add keys to appsettings.json? Also, how to read those values in our run.csx? Normally in app.config, we had Con

7条回答
  •  误落风尘
    2021-02-12 19:24

    Azure functions support only limited part of app.config. It allows to save app settings and connections in local.settings.json when running function from VS. It don't support WCF endpoint settings under system.serviceModel in this json file. I had a dll library reference in Azure Function and that was internally calling WCF apis.

    Strange thing I found is, when I run the Azure function, it converts back the json to xml config at the cli path (%localappdata%\AzureFunctionsTools\Releases\1.6.0\cli\func.exe.config). I added my xml configuration hierarchy (system.serviceModel) to this config file and it worked fine, picking my WCF endpoints to run the services. Though have struggled in using log4net configuration but am good to run the APIs. Azure should have supported the xml config files directly. Hope this helps.

提交回复
热议问题