gpt4 book ai didi

Azure 函数未触发

转载 作者:行者123 更新时间:2023-12-02 08:04:53 25 4
gpt4 key购买 nike

我无法通过 ServiceBusQueueTrigger 触发 azure 函数。

这是我所拥有的:

Azure功能:

namespace FunctionApp1
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("ngctestqueue", AccessRights.Manage, Connection = "AzureWebJobsServiceBus")]string myQueueItem, TraceWriter log)
{
log.Info($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
}
}
}

host.json{

}

local.settings.json

{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=ngctest2;AccountKey=STORAGE_ACCOUNT_KEY;EndpointSuffix=core.windows.net",
"AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=ngctest2;AccountKey=STORAGE_ACCOUNT_KEY;EndpointSuffix=core.windows.net",
"AzureWebJobsServiceBus": "Endpoint=sb://ngcservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SERVICE_BUS_KEY",
"connection": "Endpoint=sb://ngcservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SERVICE_BUS_KEY"
}
}

当我在本地通过 F5 运行该函数时,即使队列中有尚未处理的消息,它也不会被触发。:

                  %%%%%%
%%%%%%
@ %%%%%% @
@@ %%%%%% @@
@@@ %%%%%%%%%%% @@@
@@ %%%%%%%%%% @@
@@ %%%% @@
@@ %%% @@
@@ %% @@
%%
%

[10/11/2017 4:51:13 PM] Host has been specialized
Listening on http://localhost:7071/
Hit CTRL-C to exit...
[10/11/2017 4:51:13 PM] Reading host configuration file 'C:\Users\User1\source\r
epos\FunctionApp1\FunctionApp1\bin\Debug\net461\host.json'
[10/11/2017 4:51:13 PM] Host configuration file read:
[10/11/2017 4:51:13 PM] {
[10/11/2017 4:51:13 PM]
[10/11/2017 4:51:13 PM] }
[10/11/2017 4:51:14 PM] Loaded custom extension 'BotFrameworkConfiguration'
[10/11/2017 4:51:14 PM] Loaded custom extension 'SendGridConfiguration'
[10/11/2017 4:51:14 PM] Loaded custom extension 'EventGridExtensionConfig'
[10/11/2017 4:51:14 PM] Generating 1 job function(s)
[10/11/2017 4:51:14 PM] Starting Host (HostId=intelpc-1600078640, Version=1.0.11
232.0, ProcessId=27016, Debug=False, Attempt=0)
[10/11/2017 4:51:14 PM] Found the following functions:
[10/11/2017 4:51:14 PM] FunctionApp1.Function1.Run
[10/11/2017 4:51:14 PM]
[10/11/2017 4:51:14 PM] Executing HTTP request: {
[10/11/2017 4:51:14 PM] "requestId": "755084c1-3501-4e99-8629-8a9a48a60776",
[10/11/2017 4:51:14 PM] "method": "GET",
[10/11/2017 4:51:14 PM] "uri": "/"
[10/11/2017 4:51:14 PM] }
[10/11/2017 4:51:14 PM] Executed HTTP request: {
[10/11/2017 4:51:14 PM] "requestId": "755084c1-3501-4e99-8629-8a9a48a60776",
[10/11/2017 4:51:14 PM] "method": "GET",
[10/11/2017 4:51:14 PM] "uri": "/",
[10/11/2017 4:51:14 PM] "authorizationLevel": "Anonymous"
[10/11/2017 4:51:14 PM] }
[10/11/2017 4:51:14 PM] Response details: {
[10/11/2017 4:51:14 PM] "requestId": "755084c1-3501-4e99-8629-8a9a48a60776",
[10/11/2017 4:51:14 PM] "status": "OK"
[10/11/2017 4:51:14 PM] }
[10/11/2017 4:51:14 PM] Host lock lease acquired by instance ID '000000000000000
00000000017FED4C5'.
Debugger listening on [::]:5858
[10/11/2017 4:51:16 PM] Job host started

问题:我做错了什么,为什么没有触发处理队列中的消息?

我的开发环境如下:

1) Windows 8.1 专业版

2)VS2017社区15.3.5

3) Azure Functions CLI 1.0.4

其他信息在门户中显示我的队列没有消息,但在 Cloud Explorer 中显示它们。这怎么可能?

enter image description here

enter image description here

任何帮助将不胜感激。

谢谢。

最佳答案

Cloud Explorer 显示 Azure 存储队列,而不是服务总线队列。这些是不同的事情。

看起来您在两个服务中都有同名的队列。请对齐绑定(bind)和您希望消息所在的位置。

关于Azure 函数未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46693802/

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