gpt4 book ai didi

azure - 将 blobTrigger 与 Azurite 结合使用会导致函数主机崩溃

转载 作者:行者123 更新时间:2023-12-03 05:33:26 24 4
gpt4 key购买 nike

我遇到了 Azure blob 触发函数导致函数主机崩溃的问题。这似乎是存储连接字符串或我如何使用 Azurite 的问题。我正在开发的其他计时器或 HTTP 触发器函数可以在“UseDevelopmentStorage=true”设置和运行的 Azurite blob 服务下正常工作。

我对使用 Azurite 存储模拟器在我的开发环境中使用 blob 触发函数可能出现的问题感到困惑。

对我缺少什么或在哪里进一步寻找有什么建议吗?

这是函数主机启动后大约 10 到 20 秒时收到的错误消息:

An unhandled exception has occurred. Host is shutting down.Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. System.Net.Http: No connection could be made because the target machine actively refused it. System.Private.CoreLib: No connection could be made because the target machine actively refused it.

blob 触发器函数的 function.json 文件如下所示:

{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "outcontainer/{name}",
"connection": "AzureWebJobsStorage"
}
]
}

local.settings.json 文件包含以下内容:

{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}

这是启用了 --verbose 开关的控制台的输出:

[9/23/2020 6:28:36 PM] Job host started
Functions:

BlobTrigger1: blobTrigger

Hosting environment: Production
Content root path: C:\sources\AzureBlobTriggerTest
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Starting Azure Functions Python Worker.
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Worker ID: d4160c17-a9f0-461d-af04-18623c45a51b, Request ID: fdf8841e-8564-4f4e-a983-91553451cd9d, Host Address: 127.0.0.1:51168
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Successfully opened gRPC channel to 127.0.0.1:51168
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Detaching console logging.
[9/23/2020 6:28:37 PM] Switched to gRPC logging.
[9/23/2020 6:28:37 PM] Received WorkerInitRequest, request ID fdf8841e-8564-4f4e-a983-91553451cd9d
[9/23/2020 6:28:37 PM] Worker process started and initialized.
[9/23/2020 6:28:37 PM] Received FunctionLoadRequest, request ID: fdf8841e-8564-4f4e-a983-91553451cd9d, function ID: dc522140-aa0a-453b-8767-4aedf88435e4
[9/23/2020 6:28:37 PM] Successfully processed FunctionLoadRequest, request ID: fdf8841e-8564-4f4e-a983-91553451cd9d, function ID: dc522140-aa0a-453b-8767-4aedf88435e4
[9/23/2020 6:28:41 PM] Host lock lease acquired by instance ID '0000000000000000000000002B956994'.
[9/23/2020 6:29:09 PM] An unhandled exception has occurred. Host is shutting down.
[9/23/2020 6:29:09 PM] Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. System.Net.Http: No connection could be made because the target machine actively refused it. System.Private.CoreLib: No connection could be made because the target machine actively refused it.
[9/23/2020 6:29:09 PM] Stopping host...
[9/23/2020 6:29:09 PM] Stopping JobHost
[9/23/2020 6:29:09 PM] Stopping the listener 'Microsoft.Azure.WebJobs.Host.Listeners.CompositeListener' for function 'BlobTrigger1'
[9/23/2020 6:29:09 PM] Stopped the listener 'Microsoft.Azure.WebJobs.Host.Listeners.CompositeListener' for function 'BlobTrigger1'
[9/23/2020 6:29:09 PM] Job host stopped
[9/23/2020 6:29:09 PM] Host shutdown completed.

最佳答案

看来我发现我做错了什么。 The documentation says ,“Azure Blob 存储触发器需要通用存储帐户。”

我只是启动了 Azurite blob 服务。启动整个事情就可以了。

VSCode command palette

关于azure - 将 blobTrigger 与 Azurite 结合使用会导致函数主机崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64034389/

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