gpt4 book ai didi

azure - 无法访问Azure函数中的appsettings.json文件

转载 作者:行者123 更新时间:2023-12-02 07:09:13 25 4
gpt4 key购买 nike

我试图访问 Azure Function 中的 web.config 值,但后来我发现我们必须在 appsettings.json 中添加配置值。

我进行了这些更改并在 azure 函数位置上传了 appsettings.json,但没有成功。我的 azure 函数没有读取 json 文件中保存的值。

请提出前进的方向。

最佳答案

文件 local.settings.json 存储应用设置、连接字符串以及 Azure Functions Core Tools 的设置。它具有以下结构:

{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "<connection string>",
"AzureWebJobsDashboard": "<connection string>"
},
"Host": {
"LocalHttpPort": 7071,
"CORS": "*"
},
"ConnectionStrings": {
"SQLConnectionString": "Value"
}
}

我们可以从此 document 获取有关本地设置文件的更多信息.

These settings can also be read in your code as environment variables. In C#, use System.Environment.GetEnvironmentVariable or ConfigurationManager.AppSettings. In JavaScript, use process.env. Settings specified as a system environment variable take precedence over values in the local.settings.json file.

关于azure - 无法访问Azure函数中的appsettings.json文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48418404/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com