gpt4 book ai didi

c# - Azure Functions 中 local.settings.json 的值

转载 作者:行者123 更新时间:2023-11-30 20:27:28 26 4
gpt4 key购买 nike

我创建了一个如下所示的 Azure 函数(实际上,Microsoft 模板完成了大部分工作!):<​​/p>

[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("%queue-name%", AccessRights.Listen)]string myQueueItem, TraceWriter log)
{
log.Info($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
}

我的 local.settings.json 看起来像这样:

{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "..",
"AzureWebJobsDashboard": "..",
"AzureWebJobsServiceBus": "..",
"queue-name": "testqueue"

}
}

然后我部署了这个函数。这是一个奇怪的问题,因为我的问题是这立即起作用,但我没想到它会起作用。 function.json 在这里:

{
"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.0.0",
"configurationSource": "attributes",
"bindings": [
{
"type": "serviceBusTrigger",
"queueName": "%queue-name%",
"accessRights": "listen",
"name": "myQueueItem"
}
],
"disabled": false,
"scriptFile": "..\\bin\\FunctionApp8.dll",
"entryPoint": "FunctionApp8.Function1.Run"
}

显然,local.settings.json 中的值已复制到功能设置中,但我在门户中看不到它们。我的问题是:这些设置现在存储在哪里(队列名称和 AzureWebJobsServiceBus)?

编辑:

该功能的我的应用程序设置:

App Settings

最佳答案

它们将位于 Azure 门户中已发布函数应用的“应用程序设置”选项卡下(见图)。

有一些文档 here !请注意,大多数应用设置不会自动发布,需要在发布步骤或发布后进行一些配置。

Application settings

<小时/>

更新:如果两个函数正在监听同一队列上的事件,则只会触发一个函数。这可能会导致看似错误的行为,因为函数会在预期时触发/不触发。

在本例中,意外行为来自竞争函数,而不是意外连接字符串。

关于c# - Azure Functions 中 local.settings.json 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48649237/

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