消费计划中的 Azure 函数未触发(但适用于 Premium)

问题描述 投票:0回答:1

消费计划中的 Azure 函数未触发(但在 Premium 中有效) 我正在使用一个利用消费计划的 Azure Function 应用程序。当部署到高级计划时,该功能似乎可以完美执行,但在消费计划中根本不会触发。我已经验证了函数代码本身可以按预期工作。

这是我迄今为止尝试过的:

手动调用:我已通过 Azure 门户手动触发该函数,并且它在消费计划和高级计划中都成功执行。这表明函数代码本身是有效的。 触发器配置:我已经仔细检查了触发器配置(例如,Blob 存储连接字符串)并确保它对于两个计划都是准确的。 触发源测试:我模拟了来自源的触发事件(例如,上传了一个测试 blob),以查看该函数是否在消耗中触发,但没有响应。 有人在消费计划中的 Azure Functions 中遇到过这种行为吗?任何有关故障排除步骤的见解或建议将不胜感激!

azure-functions azure-app-service-plans
1个回答
0
投票

使用 Blob 存储触发功能时,请确保:

  • 触发器的存储帐户配置正确。
  • 函数应用拥有对存储帐户的适当访问权限。
  • 没有防火墙规则或网络安全组阻止访问。
  • 函数应用程序正在正确引发和消耗 blob 事件。

我尝试了示例 blob 触发函数代码,以在基于 Windows 的消费计划中使用 Azure 函数将测试 blob 上传到 Azure 存储容器。该代码在本地 Visual Studio 2022 和 Azure 门户中运行良好。

代码:

Function1.cs

using System;
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace FunctionApp111
{
    public class Function1
    {
        [FunctionName("Function1")]
        public void Run([BlobTrigger("<container_name>/{name}", Connection = "")]Stream myBlob, string name, ILogger log)
        {
            log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
        }
    }
}

local.settings.json:

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "<StorageConne_string>",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

本地输出:

enter image description here

我成功将项目发布到Azure Function应用程序,如下所示:

enter image description here

Azure 门户中的功能应用程序输出:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.