简体   繁体   English

EventHubTrigger 在 Azure Functions 中不起作用

[英]EventHubTrigger is not working in Azure Functions

I'm trying to build simple azure functions v2 application that will contain two functions, one is triggered based on TimerTrigger and another that will be triggered by EventHubTrigger .我正在尝试构建简单的azure 函数 v2应用程序,该应用程序将包含两个函数,一个基于TimerTrigger触发,另一个由EventHubTrigger触发。 Also I have IoC container configuration using Startup.cs class.我也有使用 Startup.cs 类的 IoC 容器配置。 TimerTrigger - works fine, but I have some troubles with EventHubTrigger. TimerTrigger - 工作正常,但我在使用 EventHubTrigger 时遇到了一些麻烦。 Here is my setup.这是我的设置。 EventHubFunction:事件中心函数:


namespace BgService
{
    public class MyFunctions
    {
        [FunctionName("MyFunction")]
        public async Task RunAsync([EventHubTrigger("myHubName", Connection = "hub")] string events, ILogger log)
        {

        }
    }
}

local.settings.json: local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "*****",

    "hub": "Endpoint=sb://***.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=***"
  }
}

My Startup.cs:我的 Startup.cs:

[assembly: FunctionsStartup(typeof(BgService.Startup))]
namespace BgService
{
    public class Startup : FunctionsStartup
    {


        public override void Configure(IFunctionsHostBuilder builder)
        {
           // SomeConfiguration
        }
    }

When I run my azure function project I get a next error:当我运行我的 azure 函数项目时,出现下一个错误:

[19.07.2019 12:26:23] Microsoft.Azure.WebJobs.Host: Error indexing method 'MyFunction'. Microsoft.Azure.WebJobs.EventHubs: Value cannot be null.
[19.07.2019 12:26:23] Parameter name: receiverConnectionString.

Used version of Microsoft.NET.Sdk.Functions -> 1.0.29使用的Microsoft.NET.Sdk.Functions版本 -> 1.0.29

And now the tricky part: When I downgrade the version of Microsoft.NET.Sdk.Functions to 1.0.25 without any modification in code -> it magically starts to work, BUT Startup.Configure() method is not called any more(in version 1.0.29 it is working).现在是棘手的部分:当我将Microsoft.NET.Sdk.Functions的版本降级到 1.0.25 而不对代码进行任何修改时 -> 它神奇地开始工作,但不再调用Startup.Configure()方法(在版本 1.0.29 它正在工作)。

Thanks for any assistance, spent a hours on troubleshooting this problem.感谢您的帮助,花了一个小时来解决这个问题。

Maybe this could help https://github.com/Azure/Azure-Functions/issues/1299也许这可以帮助https://github.com/Azure/Azure-Functions/issues/1299

You should as a workaround downgrade package Microsoft.Azure.EventHubs to 3.0.0您应该将 Microsoft.Azure.EventHubs 包降级到 3.0.0 作为解决方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure function 未由 EventHubTrigger 触发 - Azure function not triggered by EventHubTrigger 函数 v1 中的 EventHubTrigger - 设置 initialOffsetOptions - EventHubTrigger in functions v1 - set initialOffsetOptions 运行多个实例的Azure Function EventHubTrigger - Azure Function EventHubTrigger running multiple instances 在Azure EventHubTrigger Function应用中设置列 - Set columns in Azure EventHubTrigger Function app 使用 azure appsettings 读取 azure webjob 中 EventHubTrigger 的连接字符串 - Use azure appsettings to read connection string for EventHubTrigger in azure webjob Azure Functions绑定不起作用 - Azure Functions Bindings not working Azure函数不使用队列触发器 - Azure Functions not working with Queue Trigger Azure Function EventHubTrigger 如何从 Azure App Configuration 中读取 EventHubName 和 Connection 字符串? - Azure Function EventHubTrigger how to read EventHubName and Connection string from Azure App Configuration? 在最新的 Azure.EventHubs SDK 和 .NET 核心 3.1 中找不到 ErrorTrigger、TraceFilter、EventHubTrigger、ConsumerGroup - ErrorTrigger, TraceFilter, EventHubTrigger, ConsumerGroup not found in latest Azure.EventHubs SDK with .NET Core 3.1 Azure Functions - 表存储绑定不起作用 - Azure Functions - table storage binding not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM