Visual Studio部署队列触发器Azure功能(Visual Studio Deploying Queue Trigger Azure Function)

编程入门 行业动态 更新时间:2024-10-19 15:27:58
Visual Studio部署队列触发器Azure功能(Visual Studio Deploying Queue Trigger Azure Function)

我目前正在编写这里编写的教程,用于创建和部署队列触发的azure函数。

在第2步的“创建函数”部分中,我不清楚我们应该为“连接”字符串添加什么。 我假设它是您希望函数使用的存储帐户名称。

我遇到的另一个问题是,当我在本地系统上设置并测试Azure功能时,我将其部署到Azure,并且我没有选择要使用的当前存储帐户。

我相信当我将函数发布到azure时,这会导致创建一个新的存储帐户。 这非常令人沮丧,因为这意味着我必须使用具有丑陋GUID的存储帐户,并且还必须创建新的存储队列。 我在某处错过了一步吗?

I am currently running through the tutorial written here for creating and deploying a queue triggered azure function.

In the "Create a function" section on step 2, it isn't clear to me what we are supposed to put for the "Connection" string. I am assuming it is the storage account name that you want the function to use.

The other issue I am having is when I have set up and tested the Azure Function on my local system, I go to deploy it to Azure and I am not presented with an option to select a current storage account to use.

I believe this is causing a new storage account to be created when I publish the function to azure. This is very frustrating because that means I have to use a storage account with an ugly GUID and also have to create a new storage queue. Am I missing a step somewhere?

最满意答案

我们应该为“连接”字符串添加什么。

使用Azure Functions模板创建新项目时,将获得一个空的C#项目,其中包含以下文件: host.jsonlocal.settings.json ,您可以指定连接字符串到其他Azure服务(例如Azure存储)在local.settings.json文件中。 然后,您可以在创建函数时使用连接字符串名称设置“ 连接”选项的值。

local.settings.json

{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName={your_account_name};AccountKey={your_account_key};EndpointSuffix=core.windows.net", "AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName={your_account_name};AccountKey={your_account_key};EndpointSuffix=core.windows.net" } }

使用AzureWebJobsStorage创建一个函数并设置Connection选项的值

在此处输入图像描述

我没有看到选择要使用的当前存储帐户的选项。

我正在使用Visual Studio 2017版本15.3.0预览7.1和Azure功能和Web作业工具版本15.0.30923.0,它提供了选择存储帐户的选项。 如果可能,请升级Visual Studio并更新Azure功能和Web作业工具。

在此处输入图像描述

what we are supposed to put for the "Connection" string.

When you create a new project using the Azure Functions template, you get an empty C# project that contains the following files: host.json and local.settings.json, and you can specify connection strings to other Azure services (such as Azure storage) in local.settings.json file. And then you can set value of Connection option with connection string name when you create a function.

local.settings.json

{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName={your_account_name};AccountKey={your_account_key};EndpointSuffix=core.windows.net", "AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName={your_account_name};AccountKey={your_account_key};EndpointSuffix=core.windows.net" } }

Create a function and set value of Connection option with AzureWebJobsStorage

enter image description here

I am not presented with an option to select a current storage account to use.

I’m using Visual studio 2017 Version 15.3.0 preview 7.1 and Azure Functions and Web Jobs Tools Version 15.0.30923.0, It provides the option to choose Storage account. If possible, please upgrade your Visual Studio and update your Azure Functions and Web Jobs Tools.

enter image description here

更多推荐

本文发布于:2023-08-01 01:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1350585.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:触发器   队列   功能   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!