.net - Azure Functions 主机运行配置 - 运行所有函数

标签 .net azure azure-functions

我是 .NET 和 Azure 的新手。 我有一个从 Rider IDE 本地运行的 Azure 函数应用程序。我附上我的运行配置的屏幕截图。 它成功运行,但要求我指定哪些“要运行的函数”(屏幕截图中的红色条)。如果我不指定任何函数,它就不会运行。我想要的是它运行所有功能,因为我无法在那里提供所有功能(它是一个巨大的变化列表)。 谢谢。

enter image description here

最佳答案

Azure Functions 是在发生特定触发器时执行的代码片段。这可以是 HTTP 请求、队列中的消息、在特定容器中创建的 Blob 或基于 cron 表达式的计时器。
这意味着当 Functions 运行时运行时,一旦发生触发,所有 Functions 就准备就绪

要出于测试目的触发函数的执行,有几个选项。您可以通过调用 URL、在队列中添加消息、在容器中创建 blob 来触发触发器,或者将计时器触发器配置为 RunOnStartup (请注意,建议将其投入生产)。

另一种选择是使用可用的管理 URL。

In some contexts, you may need to run "on-demand" an Azure Function that is indirectly triggered. Examples of indirect triggers include functions on a schedule or functions that run as the result of another resource's action.

To run a non HTTP-triggered function, you need a way to send a request to Azure to run the function. The URL used to make this request takes a specific form.

Azure Functions admin URL

在Azure中调用管理URL时,需要指定Function的主 key ,但是

When running locally, the function's master key is not required. You can directly call the function omitting the x-functions-key header.

来源:Manually run a non HTTP-triggered function

编辑:
如果您通过在项目目录中运行func start来手动启动函数,则所有函数都会启动。为此,请确保安装了 Azure Functions Core Tools。

Azure Functions Core Tools lets you develop and test your functions on your local computer from the command prompt or terminal. Your local functions can connect to live Azure services, and you can debug your functions on your local computer using the full Functions runtime. You can even deploy a function app to your Azure subscription.

更多信息:Work with Azure Functions Core Tools

特别有趣:章节Run functions locally .

To run a Functions project, you run the Functions host from the root directory of your project. The host enables triggers for all functions in the project. The start command varies depending on your project language.

编辑2:
正如下面的评论所添加的:当从与 Visual Studio 不同的 IDE 运行 Azure Functions 时,例如 JetBrains 的 Rider,请确保将工作目录设置为 Functions 项目的根目录

关于.net - Azure Functions 主机运行配置 - 运行所有函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70752354/

相关文章:

Azure Functions 存储帐户 : Used capacity is constantly rising

.net - .NET Core 的地理空间库?

javascript - Azure Blob 存储 403 身份验证由于授权 header 而失败

c# - 在本地运行一次计时器触发的 Azure 函数的最简单方法是什么?

azure - 是否可以禁用 kudu scm

具有可管理的多个用户帐户的 Azure SFTP 服务器

Azure服务总线队列: re-schedule messages while increasing deliveryCount

c# - 为什么 WhenAll 无限期地等待多个 ping?

c# - MSBuild - 根据构建配置复制一个或另一个文件

c# - 使用 Javascript 创建的 Cookie 无法在 C# 代码中访问....有什么原因或其他选择吗?