无法在Azure Functions V2中注册CosmosDB绑定扩展 [英] Can't register CosmosDB binding extension in Azure Functions V2

查看:76
本文介绍了无法在Azure Functions V2中注册CosmosDB绑定扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CosmosDB输入绑定添加一个新功能(Http触发器).

I'm trying to add a new function(Http Trigger) with CosmosDB input binding.

阅读有关Azure Functions版本2中的输入绑定的手册,我发现我需要注册我的必应扩展名(

Reading a manual about input bindings in Azure Functions Version 2 I see that I need to register my binging extension(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#register-binding-extensions), and azure portal should show me some prompt for registration(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#azure-portal-development)

我很困惑,因为我没有在模板中看到CosmosDB输入绑定的选择,也没有看到任何提示.所以我试图像这样在function.json中手动添加代码:

I'm confused, because I do not see in templates choice for CosmosDB input binding and therefore any of prompts. So I tried to add code manually in function.json like this:

{
  "type": "cosmosDB",
  "name": "inputDocument",
  "databaseName": "DBName",
  "collectionName": "CollectionName",
  "connectionStringSetting": "CosmosDBConnect",
  "direction": "in",
  "Id": "myid",
  "partitionKey": "mypartitionkey"
}

当我尝试打开我的函数C#代码时,我看到错误函数错误(MyFuncName):绑定类型'cosmosDB'未注册.请确保类型正确并且绑定扩展已安装."

And when I trying to switch on my function C# code I see error "Function error(MyFuncName): The binding type(s) 'cosmosDB' are not registered. Please ensure the type is correct and the binding extension is installed."

在此页面上,我看到Azure函数版本2支持CosmosDB输入绑定(

On this page I see that CosmosDB input bindings is supported for Azure Functions Version 2(https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#supported-bindings)

推荐答案

更新

Azure CosmosDB输入/输出绑定模板已经可用,请不要忘记单击install.

Azure CosmosDB input/output binding template has been available, don't forget to click install.

您遇到了Azure门户将来可能计划支持的内容.目前,v2函数没有cosmosdb绑定选项,仅在v1中可用.已打开问题来跟踪此功能的支持.

You met something Azure portal may have planned to support in the future. For now there is no cosmosdb binding option for v2 function, only in v1 it's available. Have opened an issue to track this feature support.

解决方法是创建一个Cosmos DB触发器以安装cosmosdb扩展(实际上不需要创建触发器,仅使用它来获得安装提示),但是我们仍然必须在function.json中手动编写代码以添加绑定.

The workaround is to Create a Cosmos DB trigger to install cosmosdb extensions(no need to create trigger actually, only use it to get installation prompt), but we still have to code manually in function.json to add bindings.

这篇关于无法在Azure Functions V2中注册CosmosDB绑定扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆