gpt4 book ai didi

python - 如何在Python Azure函数中解析 "Could not load type ' Microsoft.Azure.WebJobs.ParameterBindingData'"?

转载 作者:行者123 更新时间:2023-12-02 23:01:33 25 4
gpt4 key购买 nike

我目前正在 VS Code 中开发 Azure 函数。我遇到了一个已在此 GitHub issue 中报告的错误。完整的错误内容为:Microsoft.Azure.WebJobs.Extensions.ServiceBus:无法从程序集“Microsoft.Azure.WebJobs,Version=3.0.34.0,Culture=”加载类型“Microsoft.Azure.WebJobs.ParameterBindingData”中性,PublicKeyToken=****'。值不能为空。 (参数“提供者”)

建议的解决方案之一是降级 Microsoft.Azure.WebJobs.Extensions.Storage 的包版本。但是,我不知道如何从扩展包降级包。在我的本地开发环境中,我使用以下默认 host.json 配置:

{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.15.0, 4.0.0)"
}
}

我已经尝试了多个版本范围,每个版本范围都会导致相同的错误。由于我不熟悉 .NET,如果您能提供有关如何降级软件包以解决此问题的帮助或建议,我将不胜感激。谢谢。

其他信息:我正在使用测试触发器在本地开发 EventHub 触发函数:

@app.function_name(name="EventHubTrigger1")
@app.event_hub_message_trigger(arg_name="myhub", event_hub_name="samples-workitems",
connection="")

def test_function(myhub: func.EventHubEvent):
logging.info('Python EventHub trigger processed an event: %s',
myhub.get_body().decode('utf-8'))

local.settings.json如下:

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

更新:解决此问题的另一种方法是使用以下命令重新安装/更新 azure function core 工具:

sudo apt-get update
sudo apt-get install azure-functions-core-tools-4

最佳答案

此问题已通过将版本范围更新为解决:

“版本”:“[3.3.0,3.9.0)”

关于python - 如何在Python Azure函数中解析 "Could not load type ' Microsoft.Azure.WebJobs.ParameterBindingData'"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76202060/

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